public EmployeeReport GetEmployeeReport(string lastName) { var employee = _employeeRepository.GetEmployee(lastName); var timeLogs = _timesheetRepository.GetTimesLog(employee.LastName); if (timeLogs == null || timeLogs.Length == 0) { return(new EmployeeReport { LastName = employee.LastName }); } var totalHours = timeLogs.Sum(x => x.WorkHours); var bill = employee.CalculateBill(timeLogs); return(new EmployeeReport { LastName = employee.LastName, TimeLogs = timeLogs.ToList(), Bill = bill, TotalHours = totalHours, StartDate = timeLogs.Select(t => t.Date).Min(), EndDate = timeLogs.Select(t => t.Date).Max() }); }