public async Task<IHttpActionResult> PostNCSInfo(NCSInfo nCSInfo) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.NCSInfoes.Add(nCSInfo); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (NCSInfoExists(nCSInfo.InstitutionId)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = nCSInfo.InstitutionId }, nCSInfo); }
public async Task<IHttpActionResult> PutNCSInfo(string id, NCSInfo nCSInfo) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != nCSInfo.InstitutionId) { return BadRequest(); } db.Entry(nCSInfo).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NCSInfoExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }