Пример #1
0
        public async Task <IActionResult> PostProductReviewAsync([FromBody] MProductReview review)
        {
            review.UserId = int.Parse(User.Identity.Name);
            if (!await productsRepository.CanReviewProductAsync(review.ProductId, review.UserId))
            {
                return(BadRequest());
            }

            review = await productsRepository.AddProductReviewAsync(review);

            await discordService.SendReviewAsync(review, Request.Headers["Origin"]);

            return(Ok(review));
        }