Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 public static ContactFormSection ToEntity(this ContactFormSectionModel model, ContactFormSection destination)
 {
     return(model.MapTo(destination));
 }
Ejemplo n.º 4
0
 public static ContactFormSectionModel ToModel(this ContactFormSection entity)
 {
     return(entity.MapTo <ContactFormSection, ContactFormSectionModel>());
 }