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

            return View(newStaticPageVM);
        }
Example #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);
        }
Example #3
0
        public ActionResult EditStaticPage(int id)
        {
            var vm = new AddStaticPageVM();

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

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

                return View("StaticPageDetails", page);
            }

            return View(vm);
        }