// GET: RepairParts
        public ActionResult Index(int id)
        {
            var model = new RepairPartsViewModel();

            model.RepairId    = id;
            model.RepairParts = db.GetRepairParts(id);
            if (model.RepairParts.Count() > 1)
            {
                model.PartsTotalPrice = db.GetRepairPartsPriceSum(id);
            }

            model.Parts = new List <SelectListItem>();
            foreach (var part in db.GetParts())
            {
                var item = new SelectListItem()
                {
                    Text  = part.Name,
                    Value = part.Id.ToString()
                };
                model.Parts.Add(item);
            }

            return(View(model));
        }
示例#2
0
        public IEnumerable <Part> Get()
        {
            var model = db.GetParts();

            return(model);
        }
示例#3
0
        // GET: Parts
        public ActionResult Index()
        {
            var model = db.GetParts();

            return(View(model));
        }