示例#1
0
 public IActionResult UpdateUserReviewByBookId(int userId, int bookId, [FromBody] BookReviewViewModel updatedReview)
 {
     if (updatedReview == null)
     {
         return(BadRequest());
     }
     if (!ModelState.IsValid)
     {
         return(StatusCode(412));
     }
     try
     {
         var response = _reviewsService.EditReview(userId, bookId, updatedReview);
         return(Ok(response));
     }
     catch (UserNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (BookNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (ReviewNotFoundException e)
     {
         return(NotFound(e.Message));
     }
 }