piaoshu and varchar

This commit is contained in:
王炜翔 2024-08-18 11:19:30 +08:00
parent 4c7a342cf3
commit 8105f6f144
2 changed files with 8 additions and 5 deletions

View File

@ -37,7 +37,7 @@ namespace asg_form.Controllers
{ {
TestDbContext testDb = new TestDbContext(); TestDbContext testDb = new TestDbContext();
string chinaname = user.chinaname; string chinaname = user.chinaname;
var teamgame = testDb.team_Games.Where(a => a.commentary.IndexOf(chinaname) >= 0).Select(a => new { a.id, a.team1_name, a.team2_name, a.bilibiliuri, a.commentary, a.referee ,a.opentime}).ToList(); var teamgame = testDb.team_Games.Where(a => a.commentary.IndexOf(chinaname) >= 0).Select(a => new { a.id, a.team1_name, a.team2_name, a.bilibiliuri, a.commentary, a.referee ,a.opentime,a.team1_piaoshu,a.team2_piaoshu}).OrderByDescending(a => a.opentime).ToList();
return JsonConvert.SerializeObject(teamgame); return JsonConvert.SerializeObject(teamgame);
} }

View File

@ -109,7 +109,7 @@ namespace asg_form.Controllers
if (a) if (a)
{ {
TestDbContext ctx = new TestDbContext(); TestDbContext ctx = new TestDbContext();
await ctx.news.AddAsync(new T_news { Title = req_News.Title, msg = req_News.msg, FormName = user.UserName ,time=DateTime.Now}); await ctx.news.AddAsync(new T_news { Title = req_News.Title, msg = req_News.msg, FormName = user.UserName ,time=DateTime.Now,Type=req_News.Type});
await ctx.SaveChangesAsync(); await ctx.SaveChangesAsync();
return "ok!"; return "ok!";
} }
@ -144,6 +144,7 @@ namespace asg_form.Controllers
qwq.msg=req_News.msg; qwq.msg=req_News.msg;
qwq.Title=req_News.Title; qwq.Title=req_News.Title;
qwq.FormName = user.UserName; qwq.FormName = user.UserName;
qwq.Type = req_News.Type;
await ctx.SaveChangesAsync(); await ctx.SaveChangesAsync();
} }
@ -172,6 +173,7 @@ public class T_news
public DateTime? time { get; set; } public DateTime? time { get; set; }
public string msg { get; set; } public string msg { get; set; }
public string Type { get; set; }
} }
public class req_news { public class req_news {
@ -183,6 +185,7 @@ public class T_news
/// 内容推荐使用markdown格式 /// 内容推荐使用markdown格式
/// </summary> /// </summary>
public string msg { get; set; } public string msg { get; set; }
public string Type { get; set; }
} }