public IHttpActionResult PutContactInfo(int id, ContactInfo contactInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != contactInfo.ID) { return(BadRequest()); } db.Entry(contactInfo).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ContactInfoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "RecordNumber,FirstName,LastName,PhoneNums,Email")] ContactModel contactModel) { if (ModelState.IsValid) { db.Entry(contactModel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(contactModel)); }