public JsonResult LoadData(NewsFlashModel news, GridPager pager) { var pagerTuple = Tuple.Create(pager.SortColumn, pager.OrderBy, pager.Page, pager.Size, 0, 0); var result = new NewsFlashComponent().GetRecordList(news.Title, news.Status, ref pagerTuple); pager.Count = pagerTuple.Item5; pager.TotalPage = pagerTuple.Item6; var models = result.ToGridJson(pager, item => new { Id = item.Id, CNTitle = item.CNTitle == null ? "" : item.CNTitle, ENTitle = item.ENTitle == null ? "" : item.ENTitle, CNPageView = item.CNPageView == null ? 0 : item.CNPageView, ENPageView = item.ENPageView == null ? 0 : item.ENPageView, Status = item.Status, CreateTime = item.CreateTime.AddHours(8).ToString("yyyy-MM-dd HH:mm"), Operate = item.Status }); return(Json(models, JsonRequestBehavior.AllowGet)); }
public ActionResult SavePublishFlash(NewsFlashEditModel model) { SaveResult result = new SaveResult(); if (model.Id > 0)//编辑 { if (model.Version == (int)FlashVersion.CN) { result = _component.UpdateCNVersion(new NewsFlash { CNGood = model.CNGood, CNBad = model.CNBad, CNTitle = model.CNTitle, CNContent = model.CNContent, CNSource = model.CNSource, Status = (NewsFlashStatus)model.Status, Id = model.Id }, model.CNCoverPictureUrlList, model.Version); } if (model.Version == (int)FlashVersion.EN) { result = _component.UpdateENVersion(new NewsFlash { ENGood = model.ENGood, ENBad = model.ENBad, ENTitle = model.ENTitle, ENContent = model.ENContent, ENSource = model.ENSource, Status = (NewsFlashStatus)model.Status, Id = model.Id }, model.ENCoverPictureUrlList, model.Version); } } else //新增 { NewsFlash flash = new NewsFlash { CNTitle = model.CNTitle, ENTitle = model.ENTitle, CNContent = model.CNContent, ENContent = model.ENContent, CNSource = model.CNSource, ENSource = model.ENSource, Status = (NewsFlashStatus)model.Status, AccountsId = AccountInfo.Id, CNPageView = 0, ENPageView = 0, CreateTime = DateTime.UtcNow, ModifyTime = null, CNGood = (model.Version == (int)FlashVersion.CN ? model.CNGood : model.ENGood), CNBad = (model.Version == (int)FlashVersion.CN ? model.CNBad : model.ENBad), ENGood = (model.Version == (int)FlashVersion.EN ? model.ENGood : model.CNGood), ENBad = (model.Version == (int)FlashVersion.EN ? model.ENBad : model.CNBad) }; if (model.Version == (int)FlashVersion.CN) { result = new NewsFlashComponent().Create(flash, model.CNCoverPictureUrlList, model.Version); } else { result = new NewsFlashComponent().Create(flash, model.ENCoverPictureUrlList, model.Version); } } return(Json(result.toJson())); }