Example #1
0
        public void UpdateShowByMediaId(Guid mediaId, EditShowViewModel show)
        {
            try
            {
                var result = FilmHausDbContext.Shows.Find(mediaId);

                if (result == null)
                {
                    throw new ArgumentNullException();
                }

                result.PosterUri       = show.PosterUri;
                result.MediaName       = show.MediaName;
                result.DateOfRelease   = show.DateOfRelease;
                result.Accolades       = show.Accolades;
                result.NumberOfSeasons = show.NumberOfSeasons;

                FilmHausDbContext.Entry(result).State = EntityState.Modified;
                FilmHausDbContext.SaveChanges();
            }
            catch
            {
                throw;
            }
        }
Example #2
0
        public ActionResult Edit(EditShowViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            try
            {
                ShowService.UpdateShowByMediaId(viewModel.MediaId, viewModel);
            }
            catch (Exception)
            {
                throw;
            }

            return(View("Index"));
        }