コード例 #1
0
 public ActionResult Edit([Bind(Include = "ID,Name,Categories,Quantity,Price,Picture,Description")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Categories = new SelectList(db.Categories, "ID", "CategoriesName", product.Categories);
     return(View(product));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "ID,LoginId,Password,FirstName,LastName,Address,Gender,Phonenumber,UserRole")] tblUser tblUser)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblUser).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserRole = new SelectList(db.tblRoles, "ID", "UserRole", tblUser.UserRole);
     return(View(tblUser));
 }