public ActionResult Edit([Bind(Include = "ID,CategoryName")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
Example #2
0
 public ActionResult Edit([Bind(Include = "UserID,UserName,UserAddress,CategoryID,NewField")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "CategoryName", user.CategoryID);
     return(View(user));
 }
 public ActionResult Edit([Bind(Include = "UserId,UserName,CategoryId,IsLiveUser,Test,TestInt,TestInt2,NewField,NewField2")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "CategoryName", user.CategoryId);
     return(View(user));
 }