public async Task <CartItemDto> Update(CartItemCreateOrUpdateDto input)
        {
            var entity = input.MapTo <CartItem>();

            UnitOfWork.CartRepository.Update(entity);
            await UnitOfWork.SaveAsync();

            var result  = input.MapTo <CartItemDto>();
            var product = await UnitOfWork.ProductRepository.GetByIdAsync(input.ProductId);

            var productPrice = await UnitOfWork.ProductPriceRepository.GetActiveForProduct(input.ProductId);

            result.ProductName  = product.Name;
            result.ProductPrice = productPrice.Price;
            result.ProductCode  = product.ProductCode;
            result.ProductImage = product.DefaultImage.ToString();
            return(result);
        }
        public async Task <CartItemDto> Create(CartItemCreateOrUpdateDto input)
        {
            input.UserId = HttpContext.Current.User.Identity.GetUserId();
            var entity = input.MapTo <CartItem>();

            if (entity.Count == 0)
            {
                entity.Count = 1;
            }

            var result = UnitOfWork.CartRepository.Create(entity);
            await UnitOfWork.SaveAsync();

            var product = await UnitOfWork.ProductRepository.GetByIdAsync(input.ProductId);

            var productPrice = await UnitOfWork.ProductPriceRepository.GetActiveForProduct(input.ProductId);

            result.ProductName  = product.Name;
            result.ProductPrice = productPrice.Price;
            result.ProductCode  = product.ProductCode;
            result.ProductImage = product.DefaultImage.ToString();
            return(result.MapTo <CartItemDto>());
        }