/// <summary> /// This method checks if the User with the given Id has already reviewed the Bar /// with the given Id. /// </summary> /// <param name="cocktailReviewDTO">CocktailReviewDTO object with the needed data for the review</param> /// <returns>Task</returns> public async Task CreateCocktailReviewAsync(CocktailReviewDTO cocktailReviewDTO) { if (cocktailReviewDTO.Grade > 0) { var cocktailReview = _cocktailFactory.CreateNewCocktailReview(cocktailReviewDTO.Grade, cocktailReviewDTO.Comment, cocktailReviewDTO.UserId, cocktailReviewDTO.CocktailId, cocktailReviewDTO.CreatedOn); await _context.CocktailReviews.AddAsync(cocktailReview); await _context.SaveChangesAsync(); await UpdateRating(cocktailReviewDTO.CocktailId); } else { await _context.SaveChangesAsync(); } }