Exemple #1
0
        public ActionResult Report()
        {
            ViewModelHardware vm = new ViewModelHardware();

            vm.lowerLimit = new int();
            vm.upperLimit = new int();

            return(View(vm));
        }
Exemple #2
0
        public ActionResult Report(ViewModelHardware vm)
        {
            using (HardwareDBEntities db = new HardwareDBEntities())
            {
                db.Configuration.ProxyCreationEnabled = false;
                var list = db.lgproducts.Where(pp => pp.prod_qoh >= vm.lowerLimit && pp.prod_qoh <= vm.upperLimit).ToList().Select(rr => new ReportClass
                {
                    prodDesc = rr.prod_descript,
                    prodType = rr.prod_type,
                    prodQOH  = Convert.ToInt32(rr.prod_qoh),
                });

                vm.results            = list.GroupBy(g => g.prodType).ToList();
                vm.chartData          = list.GroupBy(g => g.prodType).ToDictionary(g => g.Key, g => g.Sum(v => v.prodQOH));
                TempData["chartData"] = vm.chartData;



                return(View(vm));
            }
        }