public void UpdateFaqForContentItem(ContentItem item, EditFaqViewModel model) { var FaqPart = item.As <FaqPart>(); FaqPart.Question = model.Question; FaqPart.FaqTypeId = model.FaqType; _faqRepository.Flush(); }
private EditFaqViewModel BuildEditorViewModel(FaqPart part) { var avm = new EditFaqViewModel { Question = part.Question, FaqTypes = _faqTypeService.GetFaqTypes(false) }; if (part.FaqTypeId > 0) { avm.FaqType = part.FaqTypeId; } return(avm); }
//POST protected override DriverResult Editor(FaqPart part, IUpdateModel updater, dynamic shapeHelper) { var model = new EditFaqViewModel(); if (updater.TryUpdateModel(model, Prefix, null, null)) { if (string.IsNullOrWhiteSpace(model.Question)) { updater.AddModelError(Prefix, T("Error")); } } if (part.ContentItem.Id != 0) { _faqService.UpdateFaqForContentItem(part.ContentItem, model); } return(Editor(part, shapeHelper)); }