public ActionResult Add(VIEW_MST_ARTICLE articel) { this.ValidateRequest = false; var status = false; //1.2服务器端验证,如果没有验证通过 if (!ModelState.IsValid) { return(this.JsonFormat(ModelState, !false, "ERROR")); // return OperateContext.Current.RedirectAjax("err", "没有权限!", null, ""); } var model = VIEW_MST_ARTICLE.ToEntity(articel); try { int said = ArticleManager.Add(model); status = true; } catch (Exception e) { return(this.JsonFormat(model, !status, e.Message)); } return(this.JsonFormat(model, status, SysOperate.Add)); }
public ActionResult Update(VIEW_MST_ARTICLE articel) { this.ValidateRequest = false; var status = false; var model = ArticleManager.Get(sa => sa.ARTICLE_ID == articel.ARTICLE_ID); try { //ArticleManager.ModifyAll(ViewModelArticle.ToArticle(articel, model)); //List<MODEL.Sample_Attachments> modellist = ViewModelArticleAttachment.ToArticleAttachmentList(HttpContext); //AttachmentsManager.DelBy(at => at.itemid == model.said); //foreach (var item in modellist) //{ // AttachmentsManager.Add(item); //} //if(model.published==1) //CreateStaticPage.CreateStaticByWebClient("ArticleDetails", new List<int>() { articel.saId }); status = true; } catch (Exception e) { // UserOperateLog.WriteOperateLog("[文章管理]修改文章:" + model.title + SysOperate.Update.ToMessage(status),e.ToString()); return(this.JsonFormat(status, status, e.Message)); } //UserOperateLog.WriteOperateLog("[文章管理]修改文章:" + model.title + SysOperate.Update.ToMessage(status)); return(this.JsonFormat(model, status, SysOperate.Update)); }
public ActionResult Detail(int id) { ViewBag.CATALOG_CDS = DataSelect.ToListViewModel(VIEW_MST_CATALOG.ToListViewModel(CatalogManager.GetListBy(m => m.SYNCOPERATION != "D"))); //执行状态 var article = new MODEL.ViewModel.VIEW_MST_ARTICLE(); var model = ArticleManager.Get(a => a.ARTICLE_ID == id); if (model != null) {//转化为视图UI层的实体对象 ViewBag.ParentID = model.ARTICLE_ID; article = VIEW_MST_ARTICLE.ToViewModel(model); ViewBag.Images = JsonHelper.ToJson(VIEW_MST_ATTACHMENTS.ToListViewModel(AttachmentsManager.GetListBy(at => at.ITEM_ID == id && at.ISIMAGE == "Y")), true); } return(View(article)); }