예제 #1
0
        public void AddOrder(int user_id, int location_id, decimal orderTotal)
        {
            var date_time = DateTime.Now;

            var order = new Orders
            {
                UsersId    = user_id,
                LocationId = location_id,
                OrderTotal = orderTotal,
                OrderTime  = date_time
            };

            _db.Add(order);
        }
        public void AddOrderPizza(int?order_id, int?pizza_id)
        {
            // LINQ: First fails by throwing exception,
            // FirstOrDefault fails to just null


            var OrderPizza = new OrderPizza
            {
                OrderId = order_id,
                PizzaId = pizza_id,
            };

            _db.Add(OrderPizza);
        }
        public void AddPizzas(string size, decimal price, string name, int crust)
        {
            // LINQ: First fails by throwing exception,
            // FirstOrDefault fails to just null


            var Pizza = new Pizzas
            {
                Name  = name,
                Price = price,
                Size  = size,
                Crust = crust
            };

            _db.Add(Pizza);
        }
        public void AddInventory(string itemName, bool isTopping, int quantity, int location)
        {
            // LINQ: First fails by throwing exception,
            // FirstOrDefault fails to just null


            var inventory = new Inventory
            {
                Name       = itemName,
                IsTopping  = isTopping,
                Quantity   = quantity,
                LocationId = location
            };

            _db.Add(inventory);
        }
예제 #5
0
        public void AddUsers(string name, string lastName, string phone)
        {
            // LINQ: First fails by throwing exception,
            // FirstOrDefault fails to just null


            var User = new Users
            {
                FirstName  = name,
                LastName   = lastName,
                Phone      = phone,
                LocationId = 1
            };

            _db.Add(User);
        }