Пример #1
0
 public IActionResult DeleteFromTeam([FromBody] EmployeeTeamRequest employeeTeam)
 {
     try
     {
         var deleted = employeeService.DeleteFromTeam(mapper.Map <EmployeeTeamDto>(employeeTeam));
         if (!deleted)
         {
             return(StatusCode(404, "Employee not found"));
         }
         return(StatusCode(204, "Deleted"));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex));
     }
 }
Пример #2
0
 public IActionResult AddToTeam([FromBody] EmployeeTeamRequest employeeTeam)
 {
     try
     {
         var added = employeeService.AddToTeam(mapper.Map <EmployeeTeamDto>(employeeTeam));
         if (!added)
         {
             return(StatusCode(404, "Employee not found"));
         }
         return(StatusCode(201, "Added"));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex));
     }
 }