public void Edit(Rating rating) { _repo.Update(rating); _repo.Save(); }
public ActionResult Rate(FormCollection data) { var rating = new Rating { MovieId = new Guid(data["id"]), UserId = User.Identity.GetUserId(), ValueOfRating = Convert.ToDouble(data["rate"]) }; var movie = _movieService.GetMovieById(new Guid(data["id"])); if (movie.Ratings.Count(m => m.MovieId == movie.Id && m.UserId == User.Identity.GetUserId()) == 0) { _ratingService.AddRating(rating); } _ratingService.Edit(rating); var s = _ratingService.CountRatingByMovieId(rating.MovieId); ViewBag.Rating = s; return PartialView(); }
public void AddRating(Rating rating) { _repo.Insert(rating); _repo.Save(); }