Esempio n. 1
0
 public SectionModel(IRepository<Section> sectionContext, Section section)
 {
     Id = section.Id;
     Name = section.Name;
     Header = section.Header;
     Content = section.Content;
     Description = section.Description;
     LastUpdateDate = section.LastUpdateDate;
     OrderNumber = section.OrderNumber;
     SectionList = sectionContext.List;
     SelectedParentSection = section.ParentSection == null ? 0 : section.ParentSection.Id;
 }
Esempio n. 2
0
 public ActionResult Create(SectionModel newSection)
 {
     try
     {
         var section = new Section
         {
             Name = newSection.Name,
             Header = newSection.Header,
             Content = newSection.Content,
             Description = newSection.Description,
             OrderNumber = newSection.OrderNumber,
             ParentSection = _sectionrepository.FindById(newSection.SelectedParentSection)
         };
         _sectionrepository.Add(section);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }