public void Rate(RatingIn rating) { Rating r = new Rating(); r.Value = rating.Rate; r.MovieId = rating.MovieId; _context.Ratings.Add(r); _context.SaveChanges(); }
public ActionResult PostRating([FromForm] RatingIn rating) { if (!ModelState.IsValid) { return(BadRequest("Invalid data.")); } _ratingRepository.Rate(rating); return(Ok()); }