public ActionResult Edit(Supplier supplier) { using (var cm = new SupplierManager()) { supplier = cm.Edit(supplier); } return RedirectToAction("List"); }
public ActionResult Edit(int id) { using (var cm = new SupplierManager()) { var supplier = cm.Single(id); ViewBag.Supplier = supplier; return View("Edit"); } }
public ActionResult List() { List<Supplier> suppliers; using (var cm = new SupplierManager()) { suppliers = cm.All().ToList(); } ViewBag.Suppliers = suppliers; return View("SupplierList"); }
public ActionResult Edit(int id) { Quote quote; using (var qm = new QuoteManager()) { quote = qm.Single(id); ViewBag.Quote = quote; } // determine the supplier and materials available List<CompanyToSupplier> companySuppliers; using (var sm = new SupplierManager()) { companySuppliers = sm.ByCompanyID(quote.CompanyID.GetValueOrDefault()).ToList(); } List<Product> products; using (var mm = new MaterialsManager()) { List<Material> allMaterials = new List<Material>(); foreach (var companyToSupplier in companySuppliers) { allMaterials.AddRange(mm.BySupplier(companyToSupplier.SupplierID)); } ViewBag.AvailableMaterials = allMaterials; products = mm.ActiveProducts(quote.CompanyID.GetValueOrDefault()).ToList(); var productLines = mm.ActiveProductLines().ToList(); ViewBag.ProductLines = productLines.AsEnumerable(); ViewBag.ProductToProductLine = mm.AllProductToProductLine().ToList(); ViewBag.MaterialToProducts = mm.AllMaterialToProducts().ToList(); } ViewBag.Products = products; return View("Edit"); }
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"); }