public ActionResult List() { List<Supplier> suppliers; using (var cm = new SupplierManager()) { suppliers = cm.All().ToList(); } ViewBag.Suppliers = suppliers; return View("SupplierList"); }
public ActionResult Suppliers(int companyID) { using (var sm = new SupplierManager()) { List<Supplier> suppliers = sm.All().ToList(); ViewBag.Suppliers = suppliers.AsEnumerable(); List<CompanyToSupplier> companySuppliers = sm.ByCompanyID(companyID).ToList(); ViewBag.CompanySuppliers = companySuppliers.AsEnumerable(); } return View("Suppliers"); }