コード例 #1
0
        public ActionResult Enable(int id)
        {
            SectionViewModel section = SectionMapper.ToViewModel(sectionSrv.Get(id));

            section.IsActive = true;

            sectionSrv.Edit(SectionMapper.ToEntity(section));

            return(RedirectToAction("Disabled"));
        }
コード例 #2
0
        public ActionResult Edit(SectionViewModel model)
        {
            if (ModelState.IsValid)
            {
                var section = sectionSrv.Edit(SectionMapper.ToEntity(model));
                model = SectionMapper.ToViewModel(section);
            }

            return(RedirectToAction("Edit", new { id = model.Id }));
        }
コード例 #3
0
        public PartialViewResult TopNavigate()
        {
            TopNavigateViewModel model = new TopNavigateViewModel
            {
                CurrentUrl = HttpContext.Request.Url.AbsolutePath,
                Sections   = section.Sections
                             .Where(x => x.IsActive)
                             .Select(x => SectionMapper.ToViewModel(x))
            };

            return(PartialView("_TopNavigate", model));
        }
コード例 #4
0
        public ViewResult Edit(int id = 0)
        {
            SectionViewModel model = new SectionViewModel();

            if (id > 0)
            {
                model = SectionMapper.ToViewModel(sectionSrv.Get(id));
            }

            model.CurrentRole = UserManager.GetRoles(User.Identity.GetUserId()).FirstOrDefault();

            return(View(model));
        }