Example #1
0
        public void RemoveFromCart(RealEstate realEstate)
        {
            var shoppingCartItem =
                _appDbContext.ShoppingCartItems.SingleOrDefault(
                    s => s.RealEstate.RealEstateId == realEstate.RealEstateId && s.ShoppingCartId == ShoppingCartId);


            _appDbContext.ShoppingCartItems.Remove(shoppingCartItem);

            _appDbContext.SaveChanges();
        }
Example #2
0
        public void AddToCart(RealEstate realEstate)
        {
            var shoppingCartItem = new ShoppingCartItem
            {
                ShoppingCartId = ShoppingCartId,
                RealEstate     = realEstate
            };

            _appDbContext.ShoppingCartItems.Add(shoppingCartItem);

            _appDbContext.SaveChanges();
        }