private void BuildUI() { if (AllEmployees.Count() > _currentEmployeeIndex) { var Empobj = AllEmployees.Skip(_currentEmployeeIndex).FirstOrDefault(); if (Empobj != null) { CurrentEmployee = Empobj; List <EmployeeHours> _list = new List <EmployeeHours>(); for (var i = Convert.ToDateTime(PayStartDate); i <= Convert.ToDateTime(PayEndDate); i = i.AddDays(1)) { _list.Add(new EmployeeHours { WorkDate = i, Employee = new Employee { EmployeeNumber = CurrentEmployee.EmployeeNumber, EmployeeFirstName = CurrentEmployee.EmployeeFirstName, EmployeeLastName = CurrentEmployee.EmployeeLastName, HireDate = CurrentEmployee.HireDate }, HoursWorked = 0, Description = String.Empty }); } var db = EmployeeData.GetEmployeeHoursByEmpnonDate(CurrentEmployee.EmployeeNumber, Convert.ToDateTime(PayStartDate), Convert.ToDateTime(PayEndDate)); EmployeeHours = (from l in _list join d in db on l.WorkDate equals d.WorkDate into temp from d in temp.DefaultIfEmpty() select new EmployeeHours { WorkDate = l.WorkDate, Employee = l.Employee, Id = d == null?0:d.Id, Description = d == null?String.Empty:d.Description, HoursWorked = d == null?0 : d.HoursWorked }).ToList(); } } }