private List <HisStockListDto> LoadData(DateTime dateFrom, DateTime dataTo) { dataTo = dataTo.AddDays(1); var list1 = entryRepository.GetAllList(r => r.CreationTime >= dateFrom && r.CreationTime <= dataTo).MapTo <List <HisStockListDto> >(); var list2 = deliveryRepository.GetAllList(r => r.CreationTime >= dateFrom && r.CreationTime <= dataTo).MapTo <List <HisStockListDto> >(); var list = list1.Union(list2).ToList().AsQueryable().OrderByDescending(r => r.CreationTime).ToList(); var userIds = list.Select(r => r.CreatorUserId.ToLong()).Distinct().ToList(); var users = _userRepository.GetAllList(r => userIds.Contains(r.Id)) .Select(r => new{ r.Id, r.Name }).ToList(); foreach (var l in list) { l.CreatorUserId = users.First(r => r.Id.ToString() == l.CreatorUserId).Name; } return(list); }