public IHttpActionResult PutHospital(string id, Hospital hospital) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != hospital.Name) { return(BadRequest()); } db.Entry(hospital).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HospitalExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "Id,Name,Website,AddressNo,AddressStreet,AddressCity,AddressState,AddressZip,Emergency")] Hospital hospital) { if (ModelState.IsValid) { db.Entry(hospital).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hospital)); }