Ejemplo n.º 1
0
        public async Task <IActionResult> CreateLike([FromBody] CreateReviewLike createDTO)
        {
            try
            {
                var userId         = HttpContext.User.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier").Value;
                var entityToCreate = _mapper.Map <ReviewLike>(createDTO);
                entityToCreate.UserId = userId;
                var entity = await _reviewService.CreateReviewLikeAsync(entityToCreate);

                var view = _mapper.Map <ViewReviewLike>(entity);
                return(Ok(view));
            }
            catch
            {
                return(StatusCode(500));
            }
        }