// PUT api/EmployeeInfoAPI/5 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); }