diff --git a/asg_form/Controllers/Budget/BgCountController.cs b/asg_form/Controllers/Budget/BgCountController.cs index f8dec5b..880f5ef 100644 --- a/asg_form/Controllers/Budget/BgCountController.cs +++ b/asg_form/Controllers/Budget/BgCountController.cs @@ -173,7 +173,7 @@ namespace asg_form.Controllers.Budget var budget = await db.budgetDetails.FindAsync(request.BudgetId); if (budget == null) { - return NotFound(new { code = 404, message = "预算记录未找到" }); + return Ok(new { code = 404, message = "预算记录未找到" }); } budget.use_status = "1"; budget.use_person = request.UsePerson; diff --git a/asg_form/Controllers/Dbset.cs b/asg_form/Controllers/Dbset.cs index 9a04b86..b1f3a90 100644 --- a/asg_form/Controllers/Dbset.cs +++ b/asg_form/Controllers/Dbset.cs @@ -12,6 +12,7 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders; using System.Security.Cryptography; using System.Text; using static asg_form.Controllers.Budget.BgCountController; +using static asg_form.Controllers.InviteReferee; namespace asg_form.Controllers { @@ -244,6 +245,7 @@ namespace asg_form.Controllers public DbSet T_Comform { get; set; } public DbSet budgetDetails { get; set; } + public DbSet T_Invitation { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { string connStr = @"Host=localhost;Port=2345;Database=asg;Username=postgres;Password=luolan12323;"; diff --git a/asg_form/Controllers/InviteReferee.cs b/asg_form/Controllers/InviteReferee.cs index 2ac7b37..03c2a92 100644 --- a/asg_form/Controllers/InviteReferee.cs +++ b/asg_form/Controllers/InviteReferee.cs @@ -19,6 +19,14 @@ namespace asg_form.Controllers this.userManager = userManager; } + public class InviteBg + { + public int id { get; set; } + public int userId { get; set; } + public List myRequest { get; set; } + + } + [Route("api/v1/Invite")] [HttpGet] [Authorize] @@ -26,10 +34,21 @@ namespace asg_form.Controllers { string Invitorid = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value; var user = await userManager.FindByIdAsync(Invitorid); + long userId = user.Id; using (TestDbContext sb = new TestDbContext()) { - + try + { + //var userInvited = await userManager.Users.FirstOrDefaultAsync(x => x.Id == Inviteeid); + //if (userInvited != null) return Ok(new { code = 404, message = "用户未找到" }); + var query = await sb.T_Invitation.FindAsync(Inviteeid); + + + }catch (Exception ex) + { + return Ok(new { code = 500, message = "服务器错误", details = ex.Message }); + } return Ok(); } }