public ActionResult AddNewPage() { var newStaticPageVM = new AddStaticPageVM(); newStaticPageVM.StaticPage.User.Id = User.Identity.GetUserId(); return View(newStaticPageVM); }
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); }
public ActionResult EditStaticPage(int id) { var vm = new AddStaticPageVM(); vm.StaticPage = _ops.GetStaticPageById(id).StaticPage; return View(vm); }
public ActionResult EditStaticPage(AddStaticPageVM vm) { if (ModelState.IsValid) { var page = _ops.EditStaticPage(vm.StaticPage).StaticPage; return View("StaticPageDetails", page); } return View(vm); }