public IActionResult GetCartItemById(int cartItemId) { try { var cartItem = _repository.GetCartItemById(cartItemId); return(Ok(Mapper.Map <CartItemViewModel>(cartItem))); } catch (Exception ex) { _logger.LogError("Failed to load cart item : {0}", ex); } return(BadRequest("Failed to load cart item")); }