public ActionResult EditPage(PageVM pagevm) { if (!ModelState.IsValid) { return(View(pagevm)); } string slug = AppConstants.SlugHome; if (pagevm.Slug != "home") { var pagefound = _pagesService.GetPage(pagevm.Id); pagefound.Title = pagevm.Title; pagefound.Body = pagevm.Body; pagefound.Slug = slug; pagefound.hasSidebar = pagevm.hasSidebar; _pagesService.EditPage(pagefound); TempData["SM"] = "You have edited the page"; return(this.RedirectToAction <PagesController>(c => c.Index())); } else { ModelState.AddModelError("Generic", "Something went wrong"); return(View(pagevm)); } }