public async Task <IActionResult> AddUserMovie(AddViewModel userMovieViewModel) { //Add to UserMoviesList if (ModelState.IsValid) { var currentUserId = _userManager.GetUserId(HttpContext.User); var movie = _sqlMovieData.GetComplete(userMovieViewModel.MovieId); var movieToAdd = new UserMovie() { Added = DateTime.UtcNow, MovieId = userMovieViewModel.MovieId, UserComment = userMovieViewModel.Comment, UserRating = userMovieViewModel.Rating }; var resultMovie = await _userMovieData.Add(currentUserId, movieToAdd); movie = _sqlMovieData.AddUser(movie, currentUserId); //Add rating to AllMoviesList if (resultMovie.UserRating != 0) { _sqlMovieData.SetUserAverage(movie); } _sqlMovieData.Commit(); return(RedirectToAction(controllerName: "movie", actionName: "about", routeValues: new { id = movie.Id })); } return(View()); }