Ejemplo n.º 1
0
        public IActionResult GetRating(int itemId, int id)
        {
            if (!_itemInfoRepository.ItemExists(itemId))
            {
                _logger.LogInformation($"Item with Id {itemId} wasn't found when accessing ratings");
                return(NotFound());
            }

            var rating = _itemInfoRepository.GetRatingForItem(itemId, id);

            if (rating == null)
            {
                return(NotFound());
            }

            //var ratingResult = new RatingDto()
            //{
            //    Id = rating.Id,
            //    Name = rating.Name,
            //    Description = rating.Description
            //};

            //return Ok(ratingResult);

            return(Ok(_mapper.Map <RatingDto>(rating)));
        }