public async Task <ActionResult <List <EmployeeDTO> > > GetEmployees() { try { List <Employee> employees = await _repository.GetAll(); return(_dtoService.EmployeesToDTO(employees)); } catch (Exception exception) { return(StatusCode((int)HttpStatusCode.InternalServerError, exception.Message)); } }
public async Task <IActionResult> GetEmployeesBySubject(Guid subjectId) { try { List <Employee> employees = await _repository.GetEmployeesBySubject(subjectId); return(Ok(_dtoService.EmployeesToDTO(employees))); } catch (Exception e) { return(NotFound("Failed to get employees with error: " + e.Message)); } }