public IActionResult UpdateEmployee(int id, UpdateEmployeeItem employee) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var request = _mapper.Map <EditEmployeeRequest>(employee); request.Id = id; _commandProcessor.Process <EditEmployeeResponse, EditEmployeeRequest>(request); return(Ok()); }
public IActionResult AddEmployee(UpdateEmployeeItem employee) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var response = _commandProcessor.Process <CreateEmployeeResponse, CreateEmployeeRequest>( _mapper.Map <CreateEmployeeRequest>(employee)); var location = $"/api/staff/{response.Id}"; return(Created(location, employee)); }