public IActionResult Save(Models.PageEditModel model) { // Validate if (string.IsNullOrWhiteSpace(model.Title)) { ErrorMessage("The page could not be saved. Title is mandatory", false); return(View("Edit", model.Refresh(api))); } var ret = model.Save(api, out var alias); // Save if (ret) { if (!string.IsNullOrWhiteSpace(alias)) { TempData["AliasSuggestion"] = alias; } SuccessMessage("The page has been saved."); return(RedirectToAction("Edit", new { id = model.Id })); } else { ErrorMessage("The page could not be saved.", false); return(View("Edit", model.Refresh(api))); } }
public IActionResult Save(Models.PageEditModel model) { // Validate if (string.IsNullOrWhiteSpace(model.Title)) { ErrorMessage("The page could not be saved. Title is mandatory", false); return(View("Edit", model.Refresh(api))); } // Save if (model.Save(api)) { SuccessMessage("The page has been saved."); return(RedirectToAction("Edit", new { id = model.Id })); } else { ErrorMessage("The page could not be saved.", false); return(View("Edit", model.Refresh(api))); } }