示例#1
0
 public ActionResult Edit(Supplier supplier)
 {
     using (var cm = new SupplierManager())
     {
         supplier = cm.Edit(supplier);
     }
     return RedirectToAction("List");
 }
示例#2
0
 public ActionResult Edit(int id)
 {
     using (var cm = new SupplierManager())
     {
         var supplier = cm.Single(id);
         ViewBag.Supplier = supplier;
         return View("Edit");
     }
 }
示例#3
0
        public ActionResult List()
        {
            List<Supplier> suppliers;

            using (var cm = new SupplierManager())
            {
                suppliers = cm.All().ToList();
            }

            ViewBag.Suppliers = suppliers;
            return View("SupplierList");
        }
示例#4
0
        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");
        }
示例#5
0
 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");
 }