Exemplo n.º 1
0
        public IActionResult CreateReview([FromBody] ReviewForCreationDto 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.Create(review);

                return(Ok(true));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "Internal server error"));
            }
        }