public IHttpActionResult PostEmployee(Employee employee) { if (!ModelState.IsValid) { return BadRequest(ModelState); } //db.Employees.Add(employee); //db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = employee.ID }, employee); }
// PUT api/Employee/5 public IHttpActionResult PutEmployee(int id, Employee employee) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != employee.ID) { return BadRequest(); } //_employeeService. return StatusCode(HttpStatusCode.NoContent); }