예제 #1
0
        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));
            }
        }
예제 #2
0
        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));
            }
        }