diff --git a/asg_form/Controllers/config.cs b/asg_form/Controllers/config.cs index cdd4cf9..ad497c8 100644 --- a/asg_form/Controllers/config.cs +++ b/asg_form/Controllers/config.cs @@ -114,18 +114,18 @@ using(TestDbContext db=new TestDbContext()){ } using (TestDbContext db = new TestDbContext()) { - var query = db.T_config.AsQueryable().Where(n => msg=="null" || n.msg.Contains(msg) || n.Title.Contains(msg) || n.Substance.Contains(msg)); + var query = db.T_config.AsQueryable().Where(n => msg=="null" || n.msg==null || n.msg.Contains(msg) || n.Title.Contains(msg) || n.Substance.Contains(msg)); var TotalRecords = await query.CountAsync(); var config =await query .Skip((page - 1) * limit) .Take(limit) .ToListAsync(); - var result = new + var data = new { rows = config, total = TotalRecords, }; - return Ok(new { code = 200, message = "", result }); + return Ok(new { code = 200, message = "", data }); } } diff --git a/asg_form/Controllers/new1.cs b/asg_form/Controllers/new1.cs index 63a8312..a636939 100644 --- a/asg_form/Controllers/new1.cs +++ b/asg_form/Controllers/new1.cs @@ -1,4 +1,5 @@ +using AngleSharp.Dom; using Manganese.Array; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -54,5 +55,20 @@ namespace asg_form.Controllers } } - } + [Route("api/v2/repeatName/")] + [HttpGet] + public async Task> rpName(string teamName, int eventId) + { + TestDbContext ctx = new TestDbContext(); + bool isRepeat = ctx.Forms.Include(a => a.events).Any(a => a.team_name == teamName && a.events.Id == eventId); + if (isRepeat) + { + return Ok(new { code = 200, message = "不重复" ,data = true}); + } + else + { + return Ok(new { code = 200, message = "重复" ,data = false}); + } + } + } } \ No newline at end of file diff --git a/asg_form/Controllers/schedule.cs b/asg_form/Controllers/schedule.cs index acb7ab7..83026bf 100644 --- a/asg_form/Controllers/schedule.cs +++ b/asg_form/Controllers/schedule.cs @@ -351,7 +351,7 @@ namespace asg_form.Controllers { var query = db.team_Games.AsQueryable(); var total = query.Where(n => (belong == "null" || n.belong == belong) && (teamName1 == "null" || n.team1_name.Contains(teamName1)) && (teamName2 == "null" || n.team2_name.Contains(teamName2))).Count(); - var row = await query + var rows = await query .OrderByDescending(a => a.opentime) .Where(n => (belong=="null" || n.belong==belong) && (teamName1=="null"||n.team1_name.Contains(teamName1)) && (teamName2 == "null" || n.team2_name.Contains(teamName2))) .Skip((page - 1) * limit) @@ -359,7 +359,7 @@ namespace asg_form.Controllers .ToListAsync(); var data = new { - row, + rows, total, }; return Ok(new { code = 200, message = "", data });