public async Task Put(Contract contract) { _context.Entry(contract).State = EntityState.Modified; _context.Update(contract); await _context.SaveChangesAsync(); }
public IHttpActionResult PutEventLog(int id, EventLog eventLog) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != eventLog.ID) { return(BadRequest()); } db.Entry(eventLog).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EventLogExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "ID,Name")] Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }