for teach
This commit is contained in:
parent
d419bae3cb
commit
e0d60f249e
@ -297,12 +297,12 @@ namespace asg_form.Controllers
|
|||||||
.Take(limit)
|
.Take(limit)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
var result = new
|
var data = new
|
||||||
{
|
{
|
||||||
rows = Tasks ,
|
rows = Tasks ,
|
||||||
total = TotalRecords,
|
total = TotalRecords,
|
||||||
};
|
};
|
||||||
return Ok(result);
|
return Ok(new { code = 200, message = " ", data });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
30
asg_form/Controllers/BlackController.cs
Normal file
30
asg_form/Controllers/BlackController.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using AsmResolver.PE.DotNet.Cil;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using static asg_form.Controllers.AssignmentController;
|
||||||
|
|
||||||
|
namespace asg_form.Controllers
|
||||||
|
{
|
||||||
|
public class BlackDB
|
||||||
|
{
|
||||||
|
public int id { get; set; }
|
||||||
|
public string user_name { get; set; }
|
||||||
|
//.....
|
||||||
|
}
|
||||||
|
public class BlackController : ControllerBase
|
||||||
|
{
|
||||||
|
[Route("api/v1/blackTable")]
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<ActionResult<object>> blackAdd ([FromQuery] string userName)
|
||||||
|
{
|
||||||
|
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "nbadmin")||!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
|
||||||
|
{
|
||||||
|
return Ok(new error_mb { code = 401, message = "无权访问" });
|
||||||
|
}
|
||||||
|
TestDbContext sub = new TestDbContext();
|
||||||
|
|
||||||
|
return Ok(new { code = 200, message = "" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -289,6 +289,7 @@ namespace asg_form.Controllers
|
|||||||
public DbSet<InviteBg> T_Invitation { get; set; }
|
public DbSet<InviteBg> T_Invitation { get; set; }
|
||||||
public DbSet<menuDB> mainMenu { get; set; }
|
public DbSet<menuDB> mainMenu { get; set; }
|
||||||
public DbSet<capData> T_captcha_check { get; set; }
|
public DbSet<capData> T_captcha_check { get; set; }
|
||||||
|
public DbSet<BlackDB> T_blacks { get; set; }
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
string connStr = @"Host=localhost;Port=2345;Database=asg;Username=postgres;Password=luolan12323;";
|
string connStr = @"Host=localhost;Port=2345;Database=asg;Username=postgres;Password=luolan12323;";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user