Пример #1
0
        public bool PlaceOrder(string items, string customerName)
        {
            List <string> order     = items.Split(',').ToList();
            var           orderList = restContext.FoodOrder.Include(f => f.NameNavigation);
            int           orderNum  = orderList.ToList().Count + 1;


            var ordered = new FoodOrder
            {
                Name      = customerName,
                Ordernum  = orderNum,
                Ordertime = DateTime.Now
            };

            using (var context = new restaurantContext())
            {
                context.FoodOrder.Add(ordered);
                context.SaveChanges();
            }

            foreach (string item in order)
            {
                var itemList = new OrderItem
                {
                    Item     = item,
                    Ordernum = orderNum
                };
                using (var context = new restaurantContext())
                {
                    context.OrderItem.Add(itemList);
                    context.SaveChanges();
                }
            }
            return(true);
        }
Пример #2
0
 public bool AddCustomer(string name, string address, string storeNum, string phone)
 {
     try
     {
         var newCustomer = new Customer
         {
             Name     = name,
             Address  = address,
             Storenum = int.Parse(storeNum),
             Phone    = phone
         };
         using (var context = new restaurantContext())
         {
             context.Customer.Add(newCustomer);
             context.SaveChanges();
         }
     }
     catch
     {
         return(false);
     }
     return(true);
 }
 public IncomePaymentEventRepository(restaurantContext context)
     : base(context)
 {
 }
Пример #4
0
 public UnitOfWork(restaurantContext context)
 {
     _context = context;
 }
Пример #5
0
 public MenuRepository(restaurantContext context)
     : base(context)
 {
 }
 public IncomeReceiptRepository(restaurantContext context)
     : base(context)
 {
 }
 public CustomerRepository(restaurantContext context)
     : base(context)
 {
 }
 public OrderProcessRepository(restaurantContext context)
     : base(context)
 {
 }
 public IngredientRepository(restaurantContext context)
     : base(context)
 {
 }
Пример #10
0
 public restaurantController(restaurantContext context)
 {
     _context = context;
 }
Пример #11
0
 public Repository(restaurantContext restContext)
 {
     this.restContext = restContext;
 }
Пример #12
0
 public CheckoutRepository(restaurantContext context)
     : base(context)
 {
 }
Пример #13
0
 public AdminAccountRepository(restaurantContext context)
     : base(context)
 {
 }
 public FoodOrdersController(restaurantContext context)
 {
     _context = context;
 }
 public customerController(restaurantContext context)
 {
     _context = context;
 }
 public AdminPermissionRepository(restaurantContext context)
     : base(context)
 {
 }
Пример #17
0
 public BaseRepository(restaurantContext context)
 {
     _context = context;
 }
 public RestaurantBranchRepository(restaurantContext context)
     : base(context)
 {
 }
 public RestaurantTableRepository(restaurantContext context)
     : base(context)
 {
 }
 public AdminGroupRepository(restaurantContext context)
     : base(context)
 {
 }
 public RegistrationRepository(restaurantContext context)
     : base(context)
 {
 }
Пример #22
0
 public SupplierRepository(restaurantContext context)
     : base(context)
 {
 }
 public MenuDefinitionRepository(restaurantContext context)
     : base(context)
 {
 }
Пример #24
0
 public CustomersController(IRepository repo)
 {
     Repo     = repo ?? throw new ArgumentNullException(nameof(repo));
     _context = new restaurantContext();
 }
Пример #25
0
 public OrderChannelRepository(restaurantContext context)
     : base(context)
 {
 }
Пример #26
0
 public StateRepository(restaurantContext context)
     : base(context)
 {
 }
 public PlacedOrderRepository(restaurantContext context)
     : base(context)
 {
 }
 public PlacedOrderProcessStatusRepository(restaurantContext context)
     : base(context)
 {
 }