Beispiel #1
0
        public Customer Create(Customer customer)
        {
            var customerSaved = _ctx.Customers.Add(customer).Entity;

            _ctx.SaveChanges();
            return(customerSaved);
        }
Beispiel #2
0
        public Cart Create(Core.Entity.Cart cart)
        {
            int noStockProduct = IsStockAvailable(cart.CartLines);

            if (noStockProduct > 0)
            {
                throw new Exception($"{noStockProduct} idli ürün stokta yok!");
            }

            _ctx.Attach(cart).State = EntityState.Added;
            _ctx.SaveChanges();
            return(cart);
        }