public async Task<IHttpActionResult> PostEmployeeTalentIncubator(EmployeeTalentIncubator employeeTalentIncubator) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.EmployeeTalentIncubators.Add(employeeTalentIncubator); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (EmployeeTalentIncubatorExists(employeeTalentIncubator.IdEmployee)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = employeeTalentIncubator.IdEmployee }, employeeTalentIncubator); }
public async Task<IHttpActionResult> PutEmployeeTalentIncubator(int id, EmployeeTalentIncubator employeeTalentIncubator) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != employeeTalentIncubator.IdEmployee) { return BadRequest(); } db.Entry(employeeTalentIncubator).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeTalentIncubatorExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }