示例#1
0
        public ActionResult AddNewPage()
        {
            var newStaticPageVM = new AddStaticPageVM();
            newStaticPageVM.StaticPage.User.Id = User.Identity.GetUserId();

            return View(newStaticPageVM);
        }
示例#2
0
        public ActionResult AddNewPage(AddStaticPageVM newPage)
        {
            if (ModelState.IsValid)
            {
                newPage.StaticPage.User.UserName = User.Identity.GetUserName();
                newPage.StaticPage.TimeCreated = DateTime.Now;
                newPage.StaticPage.Status = PageStatus.Pending;

                if (User.IsInRole("Admin"))
                {
                    newPage.StaticPage.Status = PageStatus.Approved;
                }

                var page = _ops.AddNewStaticPage(newPage.StaticPage).StaticPage;

                return View("StaticPageDetails", page);
            }

            return View(newPage);
        }
示例#3
0
        public ActionResult EditStaticPage(int id)
        {
            var vm = new AddStaticPageVM();

            vm.StaticPage = _ops.GetStaticPageById(id).StaticPage;

            return View(vm);
        }
示例#4
0
        public ActionResult EditStaticPage(AddStaticPageVM vm)
        {
            if (ModelState.IsValid)
            {
                var page = _ops.EditStaticPage(vm.StaticPage).StaticPage;

                return View("StaticPageDetails", page);
            }

            return View(vm);
        }