diff --git a/asg_form/Controllers/Team/Team_http.cs b/asg_form/Controllers/Team/Team_http.cs index c0dad23..cd741c5 100644 --- a/asg_form/Controllers/Team/Team_http.cs +++ b/asg_form/Controllers/Team/Team_http.cs @@ -99,7 +99,7 @@ namespace asg_form.Controllers.Team if (imageFile == null || imageFile.Length == 0) return BadRequest("Invalid image file."); // 将文件保存到磁盘 - var filePath = Path.Combine(Directory.GetCurrentDirectory(), $"loge/", $"{imageFile.FileName}"); + var filePath = Path.Combine(Directory.GetCurrentDirectory(), $"loge/", $"{for1.team_name}.png"); using (var stream = new FileStream(filePath, FileMode.Create)) { await imageFile.CopyToAsync(stream); diff --git a/asg_form/Controllers/user_form.cs b/asg_form/Controllers/user_form.cs index aa67e76..8a8fdc4 100644 --- a/asg_form/Controllers/user_form.cs +++ b/asg_form/Controllers/user_form.cs @@ -110,20 +110,26 @@ namespace asg_form.Controllers [HttpGet] public async Task> getmyform() { - - string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value; - var ouser = userManager.Users.Include(a=>a.myteam.role).FirstOrDefault(a => a.Id == id.ToInt64()); - if (ouser.myteam == null) - { - return BadRequest(new error_mb { code = 400, message = "你没有绑定表单" }); - - } - foreach (var role in ouser.myteam.role) - { - role.Team = null; - } + try { + string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value; + var ouser = userManager.Users.Include(a => a.myteam.role).FirstOrDefault(a => a.Id == id.ToInt64()); + foreach (var role in ouser.myteam.role) + { + role.Team = null; + } return Ok(ouser.myteam); + } + catch + { + + return BadRequest(new error_mb { code = 400, message = "你没有绑定表单" }); + + + } + + + }