示例#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;
 }
 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;
 }
 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)
 {
 }
 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)
 {
 }