// 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)); }
public IEnumerable <Part> Get() { var model = db.GetParts(); return(model); }
// GET: Parts public ActionResult Index() { var model = db.GetParts(); return(View(model)); }