public ActionResult Edit(bool draft, EditModel m) { if (m.SaveAll(draft)) { ViewBag.Folder = m.Content.IsFolder ; if (m.Content.IsImage) { ViewBag.Title = Piranha.Resources.Content.EditTitleExistingImage ; if (draft) SuccessMessage(Piranha.Resources.Content.MessageImageSaved, true) ; else SuccessMessage(Piranha.Resources.Content.MessageImagePublished, true) ; } else if (m.Content.IsFolder) { ViewBag.Title = Piranha.Resources.Content.EditTitleExistingFolder ; if (draft) SuccessMessage(Piranha.Resources.Content.MessageFolderSaved, true) ; else SuccessMessage(Piranha.Resources.Content.MessageFolderPublished, true) ; } else { ViewBag.Title = Piranha.Resources.Content.EditTitleExistingDocument ; if (draft) SuccessMessage(Piranha.Resources.Content.MessageDocumentSaved, true) ; else SuccessMessage(Piranha.Resources.Content.MessageDocumentPublished, true) ; } // ModelState.Clear() ; // m.Refresh() ; // return View("Edit", m) ; return RedirectToAction("edit", new { id = m.Content.Id, returl = ViewBag.ReturnUrl }) ; } else { ViewBag.Title = Piranha.Resources.Content.EditTitleNew ; ErrorMessage(Piranha.Resources.Content.MessageNotSaved) ; return View("Edit", m) ; } }
public ActionResult Edit(EditModel m) { if (m.SaveAll()) { if (m.Content.IsImage) { ViewBag.Title = "Ändra bild" ; ViewBag.Message = "Din bild har sparats." ; } else { ViewBag.Title = "Ändra dokument" ; ViewBag.Message = "Ditt dokument har sparats." ; } return View("Edit", m) ; } else { ViewBag.Title = "Lägg till bild eller dokument" ; ViewBag.Message = "Din bild eller ditt dokument kunde inte sparas." ; return View("Edit", m) ; } }
public ActionResult Edit(EditModel m) { if (m.SaveAll()) { ViewBag.Folder = m.Content.IsFolder ; if (m.Content.IsImage) { ViewBag.Title = Piranha.Resources.Content.EditTitleExistingImage ; SuccessMessage(Piranha.Resources.Content.MessageImageSaved) ; } else if (m.Content.IsFolder) { ViewBag.Title = Piranha.Resources.Content.EditTitleExistingFolder ; SuccessMessage(Piranha.Resources.Content.MessageFolderSaved) ; } else { ViewBag.Title = Piranha.Resources.Content.EditTitleExistingDocument ; SuccessMessage(Piranha.Resources.Content.MessageDocumentSaved) ; } ModelState.Clear() ; m.Refresh() ; return View("Edit", m) ; } else { ViewBag.Title = Piranha.Resources.Content.EditTitleNew ; ErrorMessage(Piranha.Resources.Content.MessageNotSaved) ; return View("Edit", m) ; } }
public ActionResult Edit(bool draft, EditModel m) { try { // Executes the media edit before save hook, if registered if (Hooks.Manager.Media.Model.OnBeforeSave != null) Hooks.Manager.Media.Model.OnBeforeSave(this, WebPages.Manager.GetActiveMenuItem(), m) ; if (m.SaveAll(draft)) { // Executes the media edit after save hook, if registered if (Hooks.Manager.Media.Model.OnAfterSave != null) Hooks.Manager.Media.Model.OnAfterSave(this, WebPages.Manager.GetActiveMenuItem(), m) ; ViewBag.Folder = m.Content.IsFolder ; if (m.Content.IsImage) { ViewBag.Title = Piranha.Resources.Content.EditTitleExistingImage ; if (draft) { SuccessMessage(Piranha.Resources.Content.MessageImageSaved, true) ; } else { if (m.Content.Published == m.Content.LastPublished) SuccessMessage(Piranha.Resources.Content.MessageImagePublished, true) ; else SuccessMessage(Piranha.Resources.Content.MessageUpdated, true) ; } } else if (m.Content.IsFolder) { ViewBag.Title = Piranha.Resources.Content.EditTitleExistingFolder ; if (draft) { SuccessMessage(Piranha.Resources.Content.MessageFolderSaved, true) ; } else { if (m.Content.Published == m.Content.LastPublished) SuccessMessage(Piranha.Resources.Content.MessageFolderPublished, true) ; else SuccessMessage(Piranha.Resources.Content.MessageUpdated, true) ; } } else { ViewBag.Title = Piranha.Resources.Content.EditTitleExistingDocument ; if (draft) { SuccessMessage(Piranha.Resources.Content.MessageDocumentSaved, true) ; } else { if (m.Content.Published == m.Content.LastPublished) SuccessMessage(Piranha.Resources.Content.MessageDocumentPublished, true) ; else SuccessMessage(Piranha.Resources.Content.MessageUpdated, true) ; } } return RedirectToAction("edit", new { id = m.Content.Id, returl = ViewBag.ReturnUrl }) ; } else { ViewBag.Title = Piranha.Resources.Content.EditTitleNew ; ErrorMessage(Piranha.Resources.Content.MessageNotSaved) ; return View("Edit", m) ; } } catch (DuplicatePermalinkException) { // Manually set the duplicate error. ModelState.AddModelError("Permalink", @Piranha.Resources.Global.PermalinkDuplicate) ; } catch (Exception e) { ErrorMessage(e.ToString()) ; } m.Refresh() ; ViewBag.Folder = m.Content.IsFolder ; return View("Edit", m) ; }
public ActionResult Edit(bool draft, EditModel m) { try { if (m.SaveAll(draft)) { ViewBag.Folder = m.Content.IsFolder ; if (m.Content.IsImage) { ViewBag.Title = Piranha.Resources.Content.EditTitleExistingImage ; if (draft) { SuccessMessage(Piranha.Resources.Content.MessageImageSaved, true) ; } else { if (m.Content.Published == m.Content.LastPublished) SuccessMessage(Piranha.Resources.Content.MessageImagePublished, true) ; else SuccessMessage(Piranha.Resources.Content.MessageUpdated, true) ; } } else if (m.Content.IsFolder) { ViewBag.Title = Piranha.Resources.Content.EditTitleExistingFolder ; if (draft) { SuccessMessage(Piranha.Resources.Content.MessageFolderSaved, true) ; } else { if (m.Content.Published == m.Content.LastPublished) SuccessMessage(Piranha.Resources.Content.MessageFolderPublished, true) ; else SuccessMessage(Piranha.Resources.Content.MessageUpdated, true) ; } } else { ViewBag.Title = Piranha.Resources.Content.EditTitleExistingDocument ; if (draft) { SuccessMessage(Piranha.Resources.Content.MessageDocumentSaved, true) ; } else { if (m.Content.Published == m.Content.LastPublished) SuccessMessage(Piranha.Resources.Content.MessageDocumentPublished, true) ; else SuccessMessage(Piranha.Resources.Content.MessageUpdated, true) ; } } return RedirectToAction("edit", new { id = m.Content.Id, returl = ViewBag.ReturnUrl }) ; } else { ViewBag.Title = Piranha.Resources.Content.EditTitleNew ; ErrorMessage(Piranha.Resources.Content.MessageNotSaved) ; return View("Edit", m) ; } } catch (DuplicatePermalinkException) { // Manually set the duplicate error. ModelState.AddModelError("Permalink", @Piranha.Resources.Global.PermalinkDuplicate) ; } catch (Exception e) { ErrorMessage(e.ToString()) ; } m.Refresh() ; ViewBag.Folder = m.Content.IsFolder ; return View("Edit", m) ; }
public JsonResult Popup(PopupModel m) { if (ModelState.IsValid) { EditModel em = new EditModel() ; em.Content = m.NewContent ; em.FileUrl = m.FileUrl ; em.UploadedFile = m.UploadedFile ; if (em.SaveAll(false)) return new JsonResult() { Data = true } ; } return new JsonResult() { Data = false } ; }