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()); }
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 static ContactFormSection ToEntity(this ContactFormSectionModel model, ContactFormSection destination) { return(model.MapTo(destination)); }
public static ContactFormSectionModel ToModel(this ContactFormSection entity) { return(entity.MapTo <ContactFormSection, ContactFormSectionModel>()); }