Пример #1
0
        public bool DeleteShoppingCart(ShoppingCart shoppingCart)
        {
            _rShoppingCart.Remove(shoppingCart);
            var result = _uow.SaveChanges();

            if (result > 0)
                return true;
            else
                return false;
        }
Пример #2
0
        public bool SaveShoppingCart(ShoppingCart shoppingCart)
        {
            try
            {
                if (shoppingCart.Id == 0)
                {
                    _rShoppingCart.Add(shoppingCart);
                }
                else
                {
                    _uow.Entry(shoppingCart).State = EntityState.Modified;
                }
                var result = _uow.SaveChanges();

                if (result > 0)
                    return true;
                else
                    return false;
            }
            catch (Exception)
            {
                return false;
            }
        }