public IHttpActionResult PutEmployeeInfo(int id, EmployeeInfo employeeInfo) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != employeeInfo.EmpNo) { return BadRequest(); } db.Entry(employeeInfo).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EmployeeInfoExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostEmployeeInfo(EmployeeInfo employeeInfo) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.EmployeeInfoes.Add(employeeInfo); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = employeeInfo.EmpNo }, employeeInfo); }