public IActionResult Post([FromBody] EmployeeModel newEmployee) { try { employeeService.AddEmployee(newEmployee); return(Ok()); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }
public IActionResult Post([FromBody] Employee newEmployee) { try { employees.AddEmployee(newEmployee); return(Ok()); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, "Ocurrio un error al registrar el empleado")); } }
public IActionResult Post([FromBody] EmployeeModel newEmployee) { try { employeeService.AddEmployee(newEmployee); return(Ok()); } catch (Exception ex) { return(ThrowInternalErrorServer(ex)); } }
public IActionResult Post([FromBody] EmployeeModel newEmployee) { try { employeeService.AddEmployee(newEmployee); return(Ok()); } catch { throw new Exception("Mo se pudo agregar al empleado"); } }
public void Post([FromBody] EmployeeModel newEmployee) { var employee = new EmployeeSC(); employee.AddEmployee(newEmployee); }