コード例 #1
0
        public ActionResult Index()
        {
            var model   = new IndexViewModel();
            var repairs = db.GetRepairs();

            model.RepairCount = repairs.Count();
            if (model.RepairCount != 0)
            {
                model.RepairPartsCount = db.GetRepairPartsCount();
                if (model.RepairPartsCount != 0)
                {
                    model.RepairPartsTotalPrice = db.GetRepairPartsPriceSum();
                }

                model.RepairStatusCounts = new Dictionary <Status, int>();
                model.RepairStatusCounts.Add(Status.Pending, 0);
                model.RepairStatusCounts.Add(Status.InProgress, 0);
                model.RepairStatusCounts.Add(Status.WaitingForParts, 0);
                model.RepairStatusCounts.Add(Status.Completed, 0);
                foreach (var repair in repairs)
                {
                    model.RepairStatusCounts[repair.Status]++;
                }
            }
            return(View(model));
        }
コード例 #2
0
        public IEnumerable <Repair> Get()
        {
            var model = db.GetRepairs();

            return(model);
        }
コード例 #3
0
        // GET: Repairs
        public ActionResult Index()
        {
            var model = db.GetRepairs();

            return(View(model));
        }