Beispiel #1
0
        public IActionResult EditStaticPages(EditPageInputModel model)
        {
            if (ModelState.IsValid)
            {
                pageService.EditStaticPage(model.OldName, model.Name, model.Content);

                string content = string.Format("{0} modified contents of pagename: {1} / {2}.", GetCurrentUserName(User.GetUserId()), model.OldName, model.Name);
                logsService.AddNewLog("Modify", content);

                return(RedirectToAction("EditStaticPages", new { pageName = model.Name }));
            }
            else
            {
                var pageData = PopulateAdminPageViewModel(model.Name);

                pageData.Content = "";

                ViewData["message"] = "Content cannot be empty!";

                return(View(pageData));
            }
        }