public async Task <ActionResult <List <EmployeeViewModel> > > GetAll() { string username = AuthController.CurrentUserName(Request); if (String.IsNullOrEmpty(username)) { return(Unauthorized()); } List <Employee> employeeList = await context.Employees.Include(e => e.Assignment) .Include(e => e.LocalPlus) .Include(e => e.standardEmployeeCategory) .Include(e => e.location) .Include(e => e.businessUnit) .Include(e => e.organisationUnit) .Include(e => e.workingCostCentre) .Include(e => e.position) .Include(e => e.professionalArea) .Include(e => e.homeCompany) .Include(e => e.CountryofBirth) .Include(e => e.Nationality) .Include(e => e.SpouseNationality) .Include(e => e.city) .Include(e => e.typeOfVISA) .Include(e => e.assignmentStatus) .Include(e => e.Children) .Include(e => e.familyStatus) .Include(e => e.activityStatus).ToListAsync(); List <EmployeeViewModel> employees = new List <EmployeeViewModel>(); foreach (Employee employee in employeeList) { employees.Add(new EmployeeViewModel(employee)); } return(employees); }