This commit is contained in:
王炜翔 2024-09-16 20:50:59 +08:00
parent a907e26710
commit 41bb3f1d1e

View File

@ -26,6 +26,7 @@ namespace asg_form.Controllers.Teamregistration
}
public class userMsg
{
public long id { get; set; }
public string chinaname { get; set; }
public int userId { get; set; }
public int sex { get; set; }
@ -33,7 +34,7 @@ namespace asg_form.Controllers.Teamregistration
public string gameId { get; set; }
public string historyRank { get; set; }
public string contactNumber { get; set; }
public long id { get; set; }
}
public class RegisterController : ControllerBase
{
@ -50,12 +51,11 @@ namespace asg_form.Controllers.Teamregistration
[HttpPost]
[Authorize]
public async Task<ActionResult<object>> UserRgst([FromBody] userMsg msg)
{
string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
{ //var userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
using (TestDbContext sub = new TestDbContext())
{
if (sub.T_Comform.Find(userId) != null)
if (sub.T_Comform.Find(msg.userId) != null)
{
return Ok(new error_mb { code = 400, message = "你已经提交过表单了,请不要重复提交" });
}