This commit is contained in:
王炜翔 2024-11-07 16:31:07 +08:00
parent fcb54dfb5a
commit d419bae3cb
3 changed files with 22 additions and 6 deletions

View File

@ -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 });
}
}

View File

@ -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<ActionResult<string>> 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});
}
}
}
}

View File

@ -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 });