Ejemplo n.º 1
0
 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));
 }
Ejemplo n.º 2
0
 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"));
 }
Ejemplo n.º 3
0
        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;
         }
     });
 }
Ejemplo n.º 5
0
 public ActionResult Edit(int id)
 {
     Models.MovieModel movie = _movieRepository.GetMovieByID(id);
     return(View(movie));
 }
Ejemplo n.º 6
0
 public ViewResult Details(int id)
 {
     Models.MovieModel info = _movieRepository.GetBookByID(id);
     return(View(info));
 }