From 8105f6f144104baa7384c88afad330686346f64c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=82=9C=E7=BF=94?= <2307953404@qq.com> Date: Sun, 18 Aug 2024 11:19:30 +0800 Subject: [PATCH] piaoshu and varchar --- asg_form/Controllers/Com.cs | 2 +- asg_form/Controllers/news.cs | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/asg_form/Controllers/Com.cs b/asg_form/Controllers/Com.cs index 1f0d5eb..4740700 100644 --- a/asg_form/Controllers/Com.cs +++ b/asg_form/Controllers/Com.cs @@ -37,7 +37,7 @@ namespace asg_form.Controllers { TestDbContext testDb = new TestDbContext(); 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); } diff --git a/asg_form/Controllers/news.cs b/asg_form/Controllers/news.cs index a421958..cf74a1a 100644 --- a/asg_form/Controllers/news.cs +++ b/asg_form/Controllers/news.cs @@ -109,7 +109,7 @@ namespace asg_form.Controllers if (a) { 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(); return "ok!"; } @@ -144,6 +144,7 @@ namespace asg_form.Controllers qwq.msg=req_News.msg; qwq.Title=req_News.Title; qwq.FormName = user.UserName; + qwq.Type = req_News.Type; await ctx.SaveChangesAsync(); } @@ -172,7 +173,8 @@ public class T_news public DateTime? time { get; set; } public string msg { get; set; } - } + public string Type { get; set; } +} public class req_news { /// @@ -183,6 +185,7 @@ public class T_news /// 内容,推荐使用markdown格式 /// public string msg { get; set; } - - } + public string Type { get; set; } + +}