public IActionResult UpdateVideoContent([FromForm] EditVideoMetaDataViewModel vmdviewmodel) { if (!ModelState.IsValid) { return(View(vmdviewmodel)); } var videometadatafromentity = _dbContext.Videos.FirstOrDefault(v => v.Id == vmdviewmodel.Id); var updatedatedata = Mapper.Map(vmdviewmodel, videometadatafromentity, typeof(EditVideoMetaDataViewModel), typeof(VideoMetaData)); _dbContext.Update(videometadatafromentity); if (_dbContext.SaveChanges() < 0) { throw new Exception("Failed to save to database!"); } return(RedirectToAction(nameof(Index), "MovieDatabase")); }
public IActionResult MovieInfoBox() { var editMovieViewModel = new EditVideoMetaDataViewModel() { Artists = "Billy TestData, Sandy Starlet, Unknown Rando", Description = "In a world gone action film. Action McGoodMurders must save the day before the bad guy does a super villian.", EpisodeNumber = 1, Genre = "Action, Romance", Id = Guid.NewGuid(), AvailableToUsers = false, ParentalRating = ParentalRating.R, Series = "Action McGoodMurders Wild Good Guy Killing Spree", Title = "Action McGoodMurders Murders The Bad Guys!", CoverArtBase64 = @"https://memeguy.com/photos/images/had-to-make-a-fake-movie-poster-for-school-50514.png" }; return(View(editMovieViewModel)); }