public IHttpActionResult PutTable(int id, Table table) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != table.EmployeeID) { return(BadRequest()); } db.Entry(table).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TableExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "id,Name,AddressLine")] Employee employee) { if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }