Esempio n. 1
0
 public void Edit(Rating rating)
 {
     _repo.Update(rating);
     _repo.Save();
 }
Esempio n. 2
0
 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();
 }
Esempio n. 3
0
 public void AddRating(Rating rating)
 {
     _repo.Insert(rating);
     _repo.Save();
 }