private static string EditNews() { string strreturn; Guid newsID = NetSchool.Common.Library.GetPostBack.GetPostBackGuid("id", Guid.Empty); string strTitle = NetSchool.Common.Library.GetPostBack.GetPostBackStr("title"); string strContent = Microsoft.JScript.GlobalObject.unescape(NetSchool.Common.Library.GetPostBack.GetPostBackStr("content")); NetSchool.Model.News newsInfo = BLL.News.GetModel(newsID); newsInfo.Title = strTitle; newsInfo.Content = strContent; newsInfo.Editor = NetSchool.Common.Info.CurUserInfo.Username; newsInfo.EditTime = DateTime.Now; if (NetSchool.BLL.News.Update(newsInfo)) { strreturn = JsonConvert.SerializeObject(new { state = "success", msg = "OK" }, new Newtonsoft.Json.Converters.IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }); } else { strreturn = JsonConvert.SerializeObject(new { state = "error", msg = "更新失败" }, new Newtonsoft.Json.Converters.IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }); } return(strreturn); }
public ActionResult NewsShowN(Guid id) { NetSchool.Model.News newsInfo = NetSchool.BLL.News.GetModel(NewsID: id); newsInfo.ViewNum++; NetSchool.BLL.News.Update(newsInfo); return(View(newsInfo)); }
private static string GetInfo() { string strreturn; Guid newsId = NetSchool.Common.Library.GetPostBack.GetPostBackGuid("id", Guid.Empty); if (newsId != Guid.Empty) { NetSchool.Model.News newsInfo = NetSchool.BLL.News.GetModel(NewsID: newsId); newsInfo.ViewNum++; NetSchool.BLL.News.Update(newsInfo); strreturn = JsonConvert.SerializeObject(new { state = "success", msg = "OK", newsInfo = newsInfo }, new Newtonsoft.Json.Converters.IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }); } else { strreturn = JsonConvert.SerializeObject(new { state = "error", msg = "获取ID失败" }, new Newtonsoft.Json.Converters.IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }); } return(strreturn); }