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 UnPublish(Models.PageEditModel model) { if (model.Save(api, false)) { return(RedirectToAction("List")); } return(View(model)); }
public IActionResult Publish(Models.PageEditModel model) { if (model.Save(api, true)) { SuccessMessage("The page has been published."); return(RedirectToAction("Edit", new { id = model.Id })); } else { ErrorMessage("The page could not be published.", false); return(View(model)); } }
public IActionResult Publish(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, out var alias, true)) { SuccessMessage("The page has been published."); return(RedirectToAction("Edit", new { id = model.Id })); }