Ejemplo n.º 1
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.º 2
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.º 3
0
 protected void UpdateLocales(HtmlContentSection htmlContent, HtmlContentSectionModel model)
 {
     foreach (var localized in model.Locales)
     {
         _localizedEntityHelperService.SaveLocalizedValue(htmlContent,
                                                          x => x.Html,
                                                          localized.Html,
                                                          localized.LanguageId);
     }
 }
Ejemplo n.º 4
0
 public static HtmlContentSection ToEntity(this HtmlContentSectionModel model, HtmlContentSection destination)
 {
     return(model.MapTo(destination));
 }
Ejemplo n.º 5
0
 public static HtmlContentSectionModel ToModel(this HtmlContentSection entity)
 {
     return(entity.MapTo <HtmlContentSection, HtmlContentSectionModel>());
 }