This commit is contained in:
王炜翔 2024-10-04 16:23:24 +08:00
parent 8d9de377b2
commit 74cb8ff01e
2 changed files with 9 additions and 7 deletions

View File

@ -224,10 +224,10 @@ namespace asg_form.Controllers
var TotalRecords = await query.CountAsync();
var Tasks = await query
.OrderByDescending(t => t.status == "1" ? 0 :
t.status == "0" ? 1 :
t.status == "3" ? 2 :
t.status == "2" ? 3 :
.OrderByDescending(t => t.status == "1" ? 3 :
t.status == "0" ? 2 :
t.status == "3" ? 1 :
t.status == "2" ? 0 :
int.MaxValue)
.Skip((page - 1) * limit)
.Take(limit)

View File

@ -55,23 +55,25 @@ namespace asg_form.Controllers
{
if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
TestDbContext testDb = new TestDbContext();
int err = 0;
try
{
TestDbContext testDb = new TestDbContext();
var form = testDb.Forms.First(x => x.Id == req.formId);
err = 1;
var events = testDb.events.First(x => x.name == req.eventname);
err = 2;
testDb.Champions.Add(new T_Champion { events = events, form = form ,msg=req.msg});
err = 3;
await testDb.SaveChangesAsync();
return Ok();
}
catch (Exception ex)
{
return Ok(new { code = 500, message = "服务器错误",detailcode=err, details = ex.Message });
}
await testDb.SaveChangesAsync();
return Ok();
}
return BadRequest(new error_mb { code = 400, message = "你没有管理员呢~" });
}