public JsonResult LoadData(NewsViewModel news, GridPager pager) { var pagerTuple = Tuple.Create(pager.SortColumn, pager.OrderBy, pager.Page, pager.Size, 0, 0); var result = new NewsComponent().GetRecordList(news.Title, news.Status, ref pagerTuple); pager.Count = pagerTuple.Item5; pager.TotalPage = pagerTuple.Item6; var models = result.ToGridJson(pager, item => new { Title = item.CNTitle, PageView = item.PageView, Status = item.Status, CreateTime = item.CreateTime.ToString("yyyy-MM-dd HH:mm") }); return(Json(models, JsonRequestBehavior.AllowGet)); }
public ActionResult SavePublishNews(NewsEditModel model) { SaveResult result = new SaveResult(); if (model.Id > 0)//编辑 { if (model.Version == (byte)NewsSubmitFormType.CNVersion) { result = _component.UpdateCNVersion(new News { CNIntro = model.CNIntro, CNPublisher = model.CNPublisher, CNPageView = model.CNPageView, CNTitle = model.CNTitle, CNContent = model.CNContent, CNSource = model.CNSource, CNKeyword1 = model.CNKeyword1, CNKeyword2 = model.CNKeyword2, Status = (NewsStatus)model.Status, CNCoverPictureUrl = model.CNCoverPictureUrlList == null ? "" : model.CNCoverPictureUrlList[0], Id = model.Id, NewsSetionId = model.NewsSetionId }); } if (model.Version == (byte)NewsSubmitFormType.ENVersion) { result = _component.UpdateENVersion(new News { ENIntro = model.ENIntro, ENPublisher = model.ENPublisher, ENPageView = model.ENPageView, ENTitle = model.ENTitle, ENContent = model.ENContent, ENSource = model.ENSource, ENKeyword1 = model.ENKeyword1, ENKeyword2 = model.ENKeyword2, ENCoverPictureUrl = model.ENCoverPictureUrlList == null ? "" : model.ENCoverPictureUrlList[0], Status = (NewsStatus)model.Status, NewsSetionId = model.NewsSetionId, Id = model.Id }); } } else //新增 { News news = new News { CNIntro = model.CNIntro, ENIntro = model.ENIntro, CNPublisher = model.CNPublisher, ENPublisher = model.ENPublisher, CNTitle = model.CNTitle, ENTitle = model.ENTitle, CNPageView = model.CNPageView, ENPageView = model.ENPageView, CNContent = model.CNContent, ENContent = model.ENContent, CNSource = model.CNSource, ENSource = model.ENSource, CNKeyword1 = model.CNKeyword1, ENKeyword1 = model.ENKeyword1, CNKeyword2 = model.CNKeyword2, ENKeyword2 = model.ENKeyword2, Status = (NewsStatus)model.Status, CreateTime = DateTime.UtcNow, ModifyTime = null, AccountsId = AccountInfo.Id, CNCoverPictureUrl = model.CNCoverPictureUrlList == null ? "" : model.CNCoverPictureUrlList[0], ENCoverPictureUrl = model.ENCoverPictureUrlList == null ? "" : model.ENCoverPictureUrlList[0], NewsSetionId = model.NewsSetionId }; result = new NewsComponent().Create(news); } return(Json(result.toJson())); }