public async Task<IHttpActionResult> PostIdentityBinderDirectory(IdentityBinderDirectory identityBinderDirectory) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.IdentityBinderDirectory.Add(identityBinderDirectory); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (IdentityBinderDirectoryExists(identityBinderDirectory.IdentityId)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = identityBinderDirectory.IdentityId }, identityBinderDirectory); }
public async Task<IHttpActionResult> PutIdentityBinderDirectory(int id, IdentityBinderDirectory identityBinderDirectory) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != identityBinderDirectory.IdentityId) { return BadRequest(); } db.Entry(identityBinderDirectory).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IdentityBinderDirectoryExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }