// PUT api/EmployementTypeApi/5 public async Task<IHttpActionResult> PutEmployementType(int id, EmployementType employementtype) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != employementtype.EmploymentTypeId) { return BadRequest(); } db.Entry(employementtype).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployementTypeExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostEmployementType(EmployementType employementtype) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.EmployementType.Add(employementtype); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = employementtype.EmploymentTypeId }, employementtype); }