public IHttpActionResult PutPhone(int id, Phone phone) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != phone.PID) { return(BadRequest()); } db.Entry(phone).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PhoneExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Address1,CIty,State,ZipCode")] Address address) { if (ModelState.IsValid) { db.Entry(address).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(address)); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Name,DOB,Email,AddressID")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.AddressID = new SelectList(db.Addresses, "Id", "Address1", user.AddressID); return(View(user)); }