public async Task <List <EmployeeViewDTO> > GetAllEmployeesViewAsync() { List <EmployeeViewDTO> listEmployeeView = new List <EmployeeViewDTO>(); List <EmployeeDTO> listEmployees = await service.GetAllItemsAsync(); List <EmployeePostDTO> listPosts = await PostService.GetAllEmployeePostsAsync(); List <AddressViewDTO> listAddresses = await AddressService.GetAllAddressesViewAsync(); List <EmployeeDismissDTO> listDismiss = await DismissService.GetAllEmployeeDismissesAsync(); List <EmployeeViewDTO> AllList = listEmployees .Join( listAddresses, e => e.AddressID, a => a.Address.AddressID, (e, a) => new EmployeeViewDTO { Person = e, AddressView = a, Post = listPosts.Find(p => p.EmployeePostID == e.EmployeePostID), Dismisses = listDismiss .Where(d => d.EmployeeId == e.PersonId) .ToList() }).ToList(); return(AllList); }
public async Task <List <EmployeePostDTO> > GetAllPosts() { return(await employeePostService.GetAllEmployeePostsAsync()); }