public PizzaViewModel(PizzaBoxDBContext _dbContext) { orderRepo = new OrderRepository(_dbContext); Crusts = orderRepo.ReadCrusts(); Sizes = orderRepo.ReadSizes(); Toppings = orderRepo.ReadToppings(); Presets = orderRepo.ReadPrests(); foreach (var preset in Presets) { preset.Toppings = new List <ToppingModel>(); foreach (var menuPizzaTopping in preset.PizzaMenuToppings) { preset.Toppings.Add(menuPizzaTopping.Topping); } if (preset.Name == "Custom") { preset.Price = 0; } else { preset.Price = preset.CalculatePrice(); } } }
public OrderController(PizzaBoxDBContext _dbContext) { // _db = dbContext; orderViewModel = new OrderViewModel(_dbContext); pizzaViewModel = new PizzaViewModel(_dbContext); storeViewModel = new StoreViewModel(_dbContext); }
public StoreController(PizzaBoxDBContext _dbContext) { storeViewModel = new StoreViewModel(_dbContext); customerViewModel = new CustomerViewModel(_dbContext); }
public OrderRepository(PizzaBoxDBContext db) { _dbContext = db; }
public StoreRepository(PizzaBoxDBContext dbContext) { _db = dbContext; }
public CustomerController(PizzaBoxDBContext _dbContext) { customerViewModel = new CustomerViewModel(_dbContext); }
public OrderViewModel(PizzaBoxDBContext _dbContext) { repo = new OrderRepository(_dbContext); }
public CustomerRepository(PizzaBoxDBContext db) { _dbContext = db; }
public StoreViewModel(PizzaBoxDBContext _dbContext) { storeRepo = new StoreRepository(_dbContext); StoreList = storeRepo.ReadAllStores(); }
public CustomerViewModel(PizzaBoxDBContext dbContext) { CustomerRepo = new CustomerRepository(dbContext); CustomerList = CustomerRepo.ReadAllCustomers(); }