public ActionResult Delete(int id, bool?saveChangesError) { if (saveChangesError.GetValueOrDefault()) { ViewBag.ErrorMessage = "Unable to save changes. Try again, and if the problem persists see your system administrator."; } Models.MovieModel movie = _movieRepository.GetMovieByID(id); return(View(movie)); }
public ActionResult DeleteConfirmed(int id) { try { Models.MovieModel movie = _movieRepository.GetMovieByID(id); _movieRepository.DeleteMovie(id); _movieRepository.Save(); } catch (DataException) { return(RedirectToAction("Delete", new System.Web.Routing.RouteValueDictionary { { "id", id }, { "saveChangesError", true } })); } return(RedirectToAction("Index")); }
public ActionResult Create(Models.MovieModel movie) { try { if (ModelState.IsValid) { _movieRepository.InsertMovie(movie); _movieRepository.Save(); return(RedirectToAction("Index")); } } catch (DataException) { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(View(movie)); }
private void MovieDeleteRepository_DataEventStoreHandler(object sender, Models.MovieModel deleteModel) { backgroundQueue?.Enqueue(async(cancellationToken) => { try { await eventBus ?.RegisterEvent(new EventModel() { AggregateId = deleteModel.AggregateId, StateId = deleteModel.StateId, EventName = "MovieDeleted", NewPayLoad = JsonConvert.SerializeObject(deleteModel), CreatedDate = DateTime.Now }, new MovieDeletedEventHandler()) ?.BroadcastEventsAsync(); } catch { throw; } }); }
public ActionResult Edit(int id) { Models.MovieModel movie = _movieRepository.GetMovieByID(id); return(View(movie)); }
public ViewResult Details(int id) { Models.MovieModel info = _movieRepository.GetBookByID(id); return(View(info)); }