예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
 public AddressController()
 {
     context = new WholeSaleDbContext();
 }
예제 #4
0
 public AccountController()
 {
     context = new WholeSaleDbContext();
 }
예제 #5
0
 public Configuration()
 {
     context = new WholeSaleDbContext();
     AutomaticMigrationsEnabled = true;
     ContextKey = "Hurtownia.Models.WholeSaleDbContext";
 }