예제 #1
0
        public ActionResult Edit(ProductViewModel model)
        {
            if (ModelState.IsValid)
            {
                Product p = new Product()
                {
                    ProductID   = model.ProductID,
                    ProductName = model.ProductName,
                    CategoryID  = model.CategoryID,
                    SupplierID  = model.SupplierID,
                    Quantity    = (Int32)model.Quantity,
                    UnitPrice   = model.UnitPrice,

                    Description = model.Description
                };
                pbo.EditProduct(p);
                return(RedirectToAction("Index"));
            }
            ModelState.AddModelError("", "Error input!");
            ViewBag.Cat = new SelectList(catbo.GetAllCat(), "CategoryID", "CategoryName");
            return(View(model));
        }