public IHttpActionResult PutTransaction(int id, Transaction transaction) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != transaction.Id) { return(BadRequest()); } db.Entry(transaction).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TransactionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }