public ActionResult New(string tabId, int parentId, int?fieldId) { var field = FieldService.New(parentId, fieldId); var model = FieldViewModel.Create(field, tabId, parentId); return(JsonHtml("Properties", model)); }
public ActionResult New(string tabId, int parentId, string backendActionCode, FormCollection collection) { var content = FieldService.New(parentId, null); var model = FieldViewModel.Create(content, tabId, parentId); var oldLinkId = model.Data.LinkId; var oldBackward = model.Data.BackwardField; TryUpdateModel(model); model.Validate(ModelState); if (ModelState.IsValid) { try { model.Data = FieldService.Save(model.Data); PersistResultId(model.Data.Id); PersistLinkId(oldLinkId, model.Data.LinkId); PersistBackwardId(oldBackward, model.Data.BackwardField); PersistVirtualFieldIds(model.Data.NewVirtualFieldIds); PersistChildFieldIds(model.Data.ResultChildFieldIds); PersistChildLinkIds(model.Data.ResultChildLinkIds); AppendFormGuidsFromIds("DefaultArticleIds", "DefaultArticleUniqueIds"); AppendFormGuidsFromIds("Data.O2MDefaultValue", "Data.O2MUniqueIdDefaultValue"); } catch (VirtualContentProcessingException vcpe) { if (HttpContext.IsXmlDbUpdateReplayAction()) { throw; } ModelState.AddModelError("VirtualContentProcessingException", vcpe.Message); return(JsonHtml("Properties", model)); } return(Redirect("Properties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = backendActionCode, viewInListAffected = model.Data.ViewInList })); } return(JsonHtml("Properties", model)); }