//Index (works) public ActionResult GetWorkDay(DateTime dateTime, int departmentId) { if (departmentId == 0) { return(RedirectToAction("Index", null, null)); } var shifts = _shiftRepository.GetShiftsWithWorkSelectedEmployeeWithDateTimeAndDepartment(dateTime, departmentId); if (shifts.Count == 0) { return(RedirectToAction("Index", null, null)); } var ShiftResults = _shiftRepository.GetFirstShift(shifts); var shiftIds = _shiftRepository.GetShiftTypesFromShifts(dateTime, departmentId); var shifttypes = _shiftTypeRepository.GetListFromShiftTypes(shiftIds); var employees = _employeeRepository.GetEmployeesWithDepartmentId(departmentId); var workDay = new GetWorkDayViewModel { Datetime = ShiftResults.DateTime, DepartmentId = departmentId, DepartemtName = ShiftResults.Department.Name, Shifts = shifts, Departments = _context.Departments.ToList(), ShiftTypes = shifttypes, Employees = employees, }; return(View("GetWorkDay", workDay)); }