public ActionResult Index() { List <StatsViewModel> stats = new List <StatsViewModel>(); context = new WholeSaleDbContext(); foreach (var employee in context.Employees) { if (context.Orders.FirstOrDefault(x => x.EmployeeId == employee.Id) != null) { stats.Add(new StatsViewModel() { Employee = employee, Orders = context.Orders.Where(x => x.EmployeeId == employee.Id).ToList(), OrderHelperList = new List <int>() }); } } foreach (var stat in stats) { stat.Orders.ForEach(x => stat.OrderHelperList.Add(x.Id)); } return(View(stats)); }
public ViewResult Test() { // ProductRepository repo = new ProductRepository(); WholeSaleDbContext context = new WholeSaleDbContext(); var products = context.Products.AsEnumerable(); products = products.Where(x => x.ProductType.Name == "warzywo"); return(View(products)); }
public AddressController() { context = new WholeSaleDbContext(); }
public AccountController() { context = new WholeSaleDbContext(); }
public Configuration() { context = new WholeSaleDbContext(); AutomaticMigrationsEnabled = true; ContextKey = "Hurtownia.Models.WholeSaleDbContext"; }