Example #1
0
 public IActionResult AddReviewByUser([FromBody] RatingDTO rating, int userID, int bookID)
 {
     if (!ModelState.IsValid)
     {
         return(StatusCode(412));
     }
     try{
         var review = _reviewService.AddReviewByUser(rating, userID, bookID);
         return(Ok(review));
     }
     catch (RatingException e) {
         return(StatusCode(404, e.Message));
     }
     catch (ObjectNotFoundException e) {
         return(StatusCode(404, e.Message));
     }
 }