public async Task<IHttpActionResult> PostBinderResourceDirectory(BinderResourceDirectory binderResourceDirectory) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.BinderResourceDirectory.Add(binderResourceDirectory); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (BinderResourceDirectoryExists(binderResourceDirectory.BinderId)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = binderResourceDirectory.BinderId }, binderResourceDirectory); }
public async Task<IHttpActionResult> PutBinderResourceDirectory(int id, BinderResourceDirectory binderResourceDirectory) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != binderResourceDirectory.BinderId) { return BadRequest(); } db.Entry(binderResourceDirectory).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BinderResourceDirectoryExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }