public PartialViewResult AddRating(Rating rating, string username) { if (ModelState.IsValid) { rating.Username = username; _movieRepository.AddMovieRating(rating); var ratings = _movieRepository.Get(rating.MovieId).Ratings; return PartialView("_Ratings", ratings); } return PartialView(); }
public PartialViewResult AddRating(int movieId) { var rating = new Rating { MovieId = movieId }; return PartialView(); }
public void AddMovieRating(Rating rating) { _context.Ratings.Add(rating); _context.SaveChanges(); }