コード例 #1
0
 public ActionResult Edit([Bind(Include = "Id,Name,Surname,Email,Username,Password")] SiteUser sysUser)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sysUser).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sysUser));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Surname,Age,IsMarried")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "Id,Number,CountryCode,IsDefault,CustomerId")] Phone phone)
 {
     if (ModelState.IsValid)
     {
         db.Entry(phone).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerId = new SelectList(db.Customers, "Id", "Name", phone.CustomerId);
     return(View(phone));
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "Id,Description,City,Country,CustomerId")] Address address)
 {
     if (ModelState.IsValid)
     {
         db.Entry(address).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerId = new SelectList(db.Customers, "Id", "Name", address.CustomerId);
     return(View(address));
 }