public void AddLocations(string name)
        {
            var locations = new Locations
            {
                Name = name,
            };

            _db.Add(locations);
        }
        public void AddPizzas(string name, string size, int price)
        {
            var pizzas = new Pizza
            {
                Name  = name,
                Size  = size,
                Price = price
            };

            _db.Add(pizzas);
        }
        public void AddOrderPizza(int order, int?pizza, int quantity)
        {
            var orderPizza = new OrderPizza
            {
                OrderId  = order,
                PizzaId  = pizza,
                Quantity = quantity
            };

            _db.Add(orderPizza);
        }
Esempio n. 4
0
        //public IEnumerable<HasToppings> GetHasToppings()
        //{
        //    // we don't need to track changes to these, so
        //    // skip the overhead of doing so
        //    List<HasToppings> hasToppings = _db.HasToppings.AsNoTracking().ToList();
        //    return hasToppings;
        //}


        public void AddHasTopping(int?pizzaId, int locationId)
        {
            var hasTopping = new HasToppings
            {
                PizzaId    = pizzaId,
                LocationId = locationId
            };

            _db.Add(hasTopping);
            SaveChanges();
        }
        public void AddUsers(string firstName, string lastName, string phone, int location)
        {
            var users = new Users
            {
                FirstName  = firstName,
                LastName   = lastName,
                Phone      = phone,
                LocationId = location
            };

            _db.Add(users);
        }
        public void AddOrders(double?total, int location, int user, DateTime orderTime)
        {
            var orders = new Orders
            {
                Total      = total,
                LocationId = location,
                UsersId    = user,
                OrderTime  = orderTime
            };

            _db.Add(orders);
        }