예제 #1
0
        public IActionResult Get(int id)
        {
            var cartItem    = _cartItemService.GetById(id);
            var cartItemDto = _mapper.Map <CartItemDto>(cartItem);

            return(Ok(cartItemDto));
        }
예제 #2
0
        public async Task <IActionResult> GetByCartId(Guid id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.GetErrorMessages()));
            }

            try
            {
                var response = await _cartItemService.GetById(id);

                return(Ok(response));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }