// GET: Time public ActionResult Index() { var repo = new EmployeeRepository(); var employeeList = repo.GetAll(); var vm = new TimeVM(employeeList); return View(vm); }
public ActionResult TimeSheet() { var repo = new EmployeeRepository(); var timeRecords = repo.GetTimeRecords(); var employeeList = repo.GetAll(); foreach (var employee in employeeList) { employee.TimeRecords = new List<TimeRecord>(); foreach (var timeRecord in timeRecords.Where(timeRecord => timeRecord.EmpID == employee.EmpID)) { employee.TimeRecords.Add(timeRecord); employee.TimeRecords = employee.TimeRecords.OrderBy(s=>s.DateWorked).ToList(); } } return View(employeeList); }