Esempio n. 1
0
 public ActionResult Edit([Bind(Include = "ProductID,Name,ProductNumber,Color,StandardCost,ListPrice,Size,Weight,CategoryID,ProductModelID,SellStartDate,SellEndDate,DiscontinuedDate,ThumbNailPhoto,ThumbnailPhotoFileName,rowguid,ModifiedDate")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryID = new SelectList(db.ProductCategories, "CategoryID", "Name", product.CategoryID);
     return(View(product));
 }
 public ActionResult Edit([Bind(Include = "CategoryID,ParentCategoryID,Name,rowguid,ModifiedDate")] Category category)
 {
     if (category.ModifiedDate == default(DateTime))
     {
         category.ModifiedDate = System.DateTime.Now;
     }
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ParentCategoryID = new SelectList(db.ProductCategories, "CategoryID", "Name", category.ParentCategoryID);
     return(View(category));
 }