예제 #1
0
 public IActionResult Post([FromBody] EmployeeModel newEmployee)
 {
     try
     {
         employeeService.AddEmployee(newEmployee);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
     }
 }
예제 #2
0
 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));
     }
 }
예제 #4
0
 public IActionResult Post([FromBody] EmployeeModel newEmployee)
 {
     try
     {
         employeeService.AddEmployee(newEmployee);
         return(Ok());
     }
     catch
     {
         throw new Exception("Mo se pudo agregar al empleado");
     }
 }
예제 #5
0
        public void Post([FromBody] EmployeeModel newEmployee)
        {
            var employee = new EmployeeSC();

            employee.AddEmployee(newEmployee);
        }