Ejemplo n.º 1
0
        public async Task <ActionResult <RatingDTO> > AddRating(int rentalId, RatingModel rating)
        {
            try
            {
                var result = await _reviewService.AddRatingToRentalByIdAsync(rentalId, rating);

                return(CreatedAtAction(nameof(GetRating), new { ratingId = result.Id }, result.ToDto()));
            }
            catch (Exception e)
            {
                return(BadRequest(new { Title = e.Message, BadRequest().StatusCode }));
            }
        }