diff --git a/asg_form/Controllers/Teamregistration/RegisterController.cs b/asg_form/Controllers/Teamregistration/RegisterController.cs index 1594649..181c943 100644 --- a/asg_form/Controllers/Teamregistration/RegisterController.cs +++ b/asg_form/Controllers/Teamregistration/RegisterController.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc; using System.Security.Claims; using Microsoft.EntityFrameworkCore; using RestSharp.Extensions; +using System.Threading.Tasks; namespace asg_form.Controllers.Teamregistration { @@ -153,9 +154,10 @@ namespace asg_form.Controllers.Teamregistration status = form.status }; await sub.SaveChangesAsync(); - return Ok(result); + return Ok(new { code = 200, message = "成功修改", data = result }); } } + [Route("/api/v1/admin/findRegister")] [HttpGet] [Authorize] @@ -213,5 +215,32 @@ namespace asg_form.Controllers.Teamregistration return Ok(new { code=200,data = result }); } } + + [Route("api/v1/admin/refuseCom")] + [HttpGet] + [Authorize] + public async Task> refuse_com(int userId) + { + if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin")) + { + using (TestDbContext testDb = new TestDbContext()) + { + try + { + var query = testDb.T_Comform.Find(userId); + var user = await userManager.Users.FirstOrDefaultAsync(u => u.Id == userId); + if (query == null || user == null) return Ok(new { code = 404, message = "用户未找到" }); + query.status = "3"; + _ = user.officium == null; + return Ok(new { code = 200, message = "修改成功" }); + }catch (Exception ex) + { + return Ok(new { code = 500, message = "服务器错误" }); + } + + } + } + return Ok(new error_mb { code = 401, message = "没有管理员,无法设置" }); + } } } diff --git a/asg_form/Controllers/comform.cs b/asg_form/Controllers/comform.cs index d7dfa2b..43f1098 100644 --- a/asg_form/Controllers/comform.cs +++ b/asg_form/Controllers/comform.cs @@ -215,20 +215,7 @@ namespace asg_form.Controllers public string createTime { get; set; } } - [Route("api/v1/admin/refuseCom")] - [HttpGet] - [Authorize] - public async Task> refuse_com(int userId) - { - if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin")) - { - using (TestDbContext testDb = new TestDbContext()) - { - - } - } - return Ok(new error_mb { code = 401, message = "没有管理员,无法设置" }); - } + } }