public ActionResult Create(Supplier supplier)
        {
            if (ModelState.IsValid)
            {
                //db.Suppliers.Add(supplier);
                //db.SaveChanges();
                SuppMgr.AddSupplier(supplier);
                return(RedirectToAction("Index"));
            }

            ViewBag.ParishID = new SelectList(db.Parish, "ParishID", "name", supplier.ParishID);
            return(View(supplier));
        }
示例#2
0
        public void AddSupplierTest()
        {
            SupplierMgr target   = new SupplierMgr(); // TODO: Initialize to an appropriate value
            Supplier    supplier = new Supplier();    // TODO: Initialize to an appropriate value

            supplier.SupplierCode  = "ROB-100";
            supplier.SupplierName  = "Robert's Poultry";
            supplier.StreetAddress = "2 Hope Road Kingston";
            supplier.ParishID      = 1;

            try
            {
                target.AddSupplier(supplier);
            }
            catch (SupplierMgrException e)
            {
                Assert.Fail(e.ToString());//force fail of test
            }
        }