public async Task<IHttpActionResult> PutIdentityHistory(long id, IdentityHistory identityHistory) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != identityHistory.AuditId) { return BadRequest(); } db.Entry(identityHistory).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IdentityHistoryExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostIdentityHistory(IdentityHistory identityHistory) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.IdentityHistory.Add(identityHistory); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = identityHistory.AuditId }, identityHistory); }