//[ValidateInput(false)] public ActionResult Edit(HtmlContentSectionModel model, SubmitType submitType) { var page = _webPageService.GetById(model.WebPageId); if (submitType == SubmitType.Cancel) { return(Redirect(GetBasePath() + page.VirtualPath)); } if (submitType == SubmitType.Save) { if (!ModelState.IsValid) { ErrorNotification("An error occured during updating."); return(View(model)); } var entity = (HtmlContentSection)_sectionService.GetById(model.Id); entity = model.ToEntity(entity); _sectionService.Update(entity); //locales UpdateLocales(entity, model); SuccessNotification("Updated successfully. ", false); } return(View(model)); }
protected void UpdateLocales(HtmlContentSection htmlContent, HtmlContentSectionModel model) { foreach (var localized in model.Locales) { _localizedEntityHelperService.SaveLocalizedValue(htmlContent, x => x.Html, localized.Html, localized.LanguageId); } }
public static HtmlContentSection ToEntity(this HtmlContentSectionModel model, HtmlContentSection destination) { return(model.MapTo(destination)); }
public static HtmlContentSection ToEntity(this HtmlContentSectionModel model) { return(model.MapTo <HtmlContentSectionModel, HtmlContentSection>()); }