public bool UpdateQuantityInCart(ProductCartModel productCartModel)
        {
            var productCartEntity = new ProductCartDTO();
            var productCartRepository = new ProductCartRepository();

            AutoMapper.Mapper.Map(productCartModel, productCartEntity);
            var status = productCartRepository.UpdateQuantityInCart(productCartEntity);

            return status;
        }
        public bool InsertProductCart(ProductCartModel productCartModel)
        {
            var productCartEntity = new ProductCartDTO();
            var productCartRepository = new ProductCartRepository();

            AutoMapper.Mapper.Map(productCartModel, productCartEntity);
            bool status = productCartRepository.InsertProductCart(productCartEntity);

            return status;
        }
        public bool InsertProductCart(ProductCartDTO productCart)
        {
            SqlParameter[] _sqlParams = new SqlParameter[]
            {
                new SqlParameter("@Id", productCart.Id),
                new SqlParameter("@ProductId", productCart.ProductId),
                new SqlParameter("@Quantity", productCart.Quantity),
                new SqlParameter("@CartId", productCart.CartId),
                new SqlParameter("@ReturnValue", SqlDbType.SmallInt)
            };

            _sqlParams[4].Direction = ParameterDirection.Output;
            SqlHelper.ExecuteNonQuery(ConnectionClass.OpenConnection(), CommandType.StoredProcedure,
                AppConstants.INSERTPRODUCTCART, _sqlParams);

            Int16 returnValue = Convert.ToInt16(_sqlParams[4].Value);
            bool status = returnValue > 0 ? true : false;
            return status;
        }
 private ProductCartDTO PopulateCartItems(IDataRecord dataRecord)
 {
     ProductCartDTO productCart = new ProductCartDTO();
     productCart.Id = Convert.ToInt32(dataRecord["Id"]);
     productCart.ProductId = Convert.ToInt32(dataRecord["ProductId"]);
     productCart.CartId = new Guid(Convert.ToString(dataRecord["CartId"]));
     productCart.CategoryName = Convert.ToString(dataRecord["CategoryName"]);
     productCart.ImageUrl = Convert.ToString(dataRecord["ImageURL"]);
     productCart.Quantity = Convert.ToInt32(dataRecord["Quantity"]);
     productCart.UnitPrice = Convert.ToDecimal(dataRecord["UnitPrice"]);
     productCart.Price = Convert.ToDecimal(dataRecord["Price"]);
     return productCart;
 }