Exemplo n.º 1
0
        public IActionResult UpdateReview([FromBody] ReviewForUpdateDto review)
        {
            try
            {
                if (review == null)
                {
                    _logger.LogError("Review object sent from client is null.");
                    return(BadRequest("Review object is null"));
                }

                if (!ModelState.IsValid)
                {
                    _logger.LogError("Invalid Review object sent from client.");
                    return(BadRequest("Invalid model object"));
                }

                bool succes = _reviewLogic.Update(review);
                if (!succes)
                {
                    return(NotFound());
                }

                return(Ok("Review is updated"));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "Internal server error"));
            }
        }
Exemplo n.º 2
0
 public int Update(Review review)
 {
     return(_reviewLogic.Update(review));
 }