void AccountTourManage_EditSave(object sender, ItemModuleModeEventArgs e) { AuthoriseRequestSid(); string title = core.Http.Form["title"]; short year = core.Functions.FormShort("year", (short)DateTime.UtcNow.Year); string tourAbstract = core.Http.Form["abstract"]; switch (e.Mode) { case "add": try { Tour.Create(core, (Musician)Owner, title, year, tourAbstract); } catch (InvalidTourException) { return; } SetRedirectUri(BuildUri()); core.Display.ShowMessage("Tour Added", "The tour has been saved in the database"); break; case "edit": Tour tour = (Tour)e.Item; if (tour == null) { return; } tour.Title = title; tour.StartYear = year; tour.TourAbstract = tourAbstract; tour.Update(); break; } }
void AccountBlogRoll_SaveNew(object sender, ItemModuleModeEventArgs e) { AuthoriseRequestSid(); string title = core.Http.Form["title"]; string uri = core.Http.Form["uri"]; if (string.IsNullOrEmpty(title)) { SetError("Title cannot be empty"); return; } if (string.IsNullOrEmpty(uri)) { SetError("URI cannot be empty"); return; } if (e.Mode == "new") { BlogRollEntry bre = BlogRollEntry.Create(core, title, uri); SetRedirectUri(BuildUri()); core.Display.ShowMessage("Blog Roll Entry Created", "The blog roll entry has been created"); } else if (e.Mode == "edit") { long id = core.Functions.FormLong("id", 0); BlogRollEntry bre = (BlogRollEntry)e.Item; if (bre == null) { DisplayGenericError(); return; } bre.Title = title; bre.EntryUri = uri; bre.Update(); SetRedirectUri(BuildUri()); core.Display.ShowMessage("Blog Roll Entry Saved", "The blog roll entry has been saved"); } }