Пример #1
0
        public async Task <ActionResult <TriviaDTO> > AddTrivia(int rentalId, TriviaModel trivia)
        {
            try
            {
                var result = await _reviewService.AddTriviaToRentalByIdAsync(rentalId, trivia);

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