public ActionResult Properties(string tabId, int parentId, int id, string successfulActionCode, bool?boundToExternal) { var data = ArticleService.Read(id, parentId, successfulActionCode); var model = ArticleViewModel.Create(data, parentId, tabId, successfulActionCode, boundToExternal); return(JsonHtml("Properties", model)); }
public ActionResult New(string tabId, int parentId, int?fieldId, int?articleId, bool?isChild, bool?boundToExternal) { var data = ArticleService.New(parentId, fieldId, articleId, isChild, boundToExternal); var model = ArticleViewModel.Create(data, tabId, parentId, boundToExternal); return(JsonHtml("Properties", model)); }
public ActionResult ArchiveProperties(string tabId, int parentId, int id, bool?boundToExternal) { var data = ArticleService.ReadArchive(id, parentId); var model = ArticleViewModel.Create(data, tabId, parentId, boundToExternal); return(JsonHtml("Properties", model)); }
public async Task <ActionResult> LiveProperties(string tabId, int parentId, int id, bool?boundToExternal) { var data = ArticleService.ReadLive(id, parentId); var model = ArticleViewModel.Create(data, tabId, parentId, boundToExternal); model.IsLive = true; return(await JsonHtml("Properties", model)); }
public ActionResult PropertiesPost(string tabId, int parentId, int id, string backendActionCode, bool?boundToExternal) { var data = ArticleService.ReadForUpdate(id, parentId); var model = ArticleViewModel.Create(data, tabId, parentId, boundToExternal); // ReSharper disable once PossibleInvalidOperationException PersistFromId(model.Data.Id, model.Data.UniqueId.Value); TryUpdateModel(model); model.Validate(ModelState); if (ModelState.IsValid) { try { model.Data = ArticleService.Update(model.Data, backendActionCode, boundToExternal, HttpContext.IsXmlDbUpdateReplayAction()); // ReSharper disable once PossibleInvalidOperationException PersistResultId(model.Data.Id, model.Data.UniqueId.Value); var union = model.Data.AggregatedArticles.Any() ? model.Data.FieldValues.Union(model.Data.AggregatedArticles.SelectMany(f => f.FieldValues)) : model.Data.FieldValues; foreach (var fv in union.Where(f => new[] { FieldExactTypes.O2MRelation, FieldExactTypes.M2MRelation, FieldExactTypes.M2ORelation }.Contains(f.Field.ExactType))) { AppendFormGuidsFromIds($"field_{fv.Field.Id}", $"field_uniqueid_{fv.Field.Id}"); } return(Redirect("Properties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = backendActionCode, boundToExternal })); } catch (ActionNotAllowedException nae) { ModelState.AddModelError("OperationIsNotAllowedForAggregated", nae.Message); return(JsonHtml("Properties", model)); } } return(JsonHtml("Properties", model)); }
public ActionResult ArticalGVPAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] ArticleViewModel Article) { if (ModelState.IsValid) { try { // Insert here a code to insert the new Article in your model Article.Create(); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = Article.GetModelStateError(ModelState); } ViewData["ContentsValue"] = Article.Contents; var model = ArticleViewModel.GetArticalList(); return(PartialView(ArticleView, model)); }