public UnitofWork(PizzaBoxContext context)
 {
     _context    = context;
     Customer    = new CustomerRepository(_context);
     Employee    = new EmployeeRepository(_context);
     Pizza       = new PizzaRepository(_context);
     Order       = new OrderRepository(_context);
     Address     = new AddressRepository(_context);
     Store       = new StoreRepository(_context);
     Ingrediants = new IngredientsRepository(_context);
 }
Exemplo n.º 2
0
 public UnitOfWork(PizzaBoxContext context)
 {
     _context  = context;
     Stores    = new StoreRepository(context);
     Customers = new CustomerRepository(context);
     Crusts    = new CrustRepository(context);
     Sizes     = new SizeRepository(context);
     Toppings  = new ToppingRepository(context);
     Pizzas    = new PizzaRepository(context);
     Orders    = new OrderRepository(context);
 }
Exemplo n.º 3
0
 public static List <Order> StoreHistory(PizzaBoxContext context, int StoreID)
 {
     return(context.Orders
            .Where(a => a.Store.EntityID == StoreID)
            .Include(b => b.Customer)
            .Include(b => b.Items)
            .ThenInclude(b => b.Crust)
            .Include(b => b.Items)
            .ThenInclude(b => b.Size)
            .Include(b => b.Items)
            .ThenInclude(b => b.Toppings)
            .ToList());
 }
Exemplo n.º 4
0
 public PizzaBoxRepository(PizzaBoxContext context)
 {
     _ctx = context;
 }
Exemplo n.º 5
0
 public static void Save <T>(PizzaBoxContext context, T ThingToSave) where T : class
 {
     context.Add(ThingToSave);
     context.SaveChanges();
 }