public ActionResult AddSection(int pageId, IFormCollection collection) { var selectedValue = collection["selectedSection"]; var page = _webPageService.GetById(pageId); Section section = null; switch (selectedValue.ToString().ToLower()) { case "html": section = new HtmlContentSection(); break; case "contactform": section = new ContactFormSection { EmailTo = "*****@*****.**" }; break; case "resume": section = new WorkHistorySection { ApplicationUserName = HttpContext.User.Identity.Name }; break; } section.WebPage = page; _sectionService.Insert(section); return(Redirect(GetBasePath() + page.VirtualPath)); }
public ActionResult AddSection(int pageId, string selectedValue) { var page = _webPageService.GetById(pageId); Section section = null; switch (selectedValue.ToLower()) { case "htmlcontent": section = new HtmlContentSection(); break; case "contactform": section = new ContactFormSection { EmailTo = "*****@*****.**" }; break; case "resume": section = new ResumeSection { ApplicationUserName = HttpContext.User.Identity.Name }; break; } section.WebPage = page; _sectionService.Insert(section); return(NoContent()); }
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 HtmlContentSectionModel ToModel(this HtmlContentSection entity) { return(entity.MapTo <HtmlContentSection, HtmlContentSectionModel>()); }