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); }
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) { }
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) { }
public restaurantController(restaurantContext context) { _context = context; }
public Repository(restaurantContext restContext) { this.restContext = restContext; }
public CheckoutRepository(restaurantContext context) : base(context) { }
public AdminAccountRepository(restaurantContext context) : base(context) { }
public FoodOrdersController(restaurantContext context) { _context = context; }
public customerController(restaurantContext context) { _context = context; }
public AdminPermissionRepository(restaurantContext context) : base(context) { }
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) { }
public CustomersController(IRepository repo) { Repo = repo ?? throw new ArgumentNullException(nameof(repo)); _context = new restaurantContext(); }
public OrderChannelRepository(restaurantContext context) : base(context) { }
public StateRepository(restaurantContext context) : base(context) { }
public PlacedOrderRepository(restaurantContext context) : base(context) { }
public PlacedOrderProcessStatusRepository(restaurantContext context) : base(context) { }