コード例 #1
0
        public IActionResult IndexEmployer()
        {
            string          userId    = User.FindFirstValue(ClaimTypes.NameIdentifier);
            string          companyId = _companyHandler.GetCompanyFromUser(userId).CompanyId;
            List <Schedule> schedules =
                _scheduleCollection.GetSchedulesFromCompany(companyId);

            if (schedules.Count > 0)
            {
                IndexEmployerViewModel model = new IndexEmployerViewModel()
                {
                    Schedules     = schedules,
                    CompanyID     = companyId,
                    TodaysWorkers = _scheduleCollection.GetTodaysShifts(companyId, DateTime.Today)
                };
                return(View(model));
            }
            else
            {
                IndexEmployerViewModel model = new IndexEmployerViewModel()
                {
                    Schedules     = new List <Schedule>(),
                    CompanyID     = companyId,
                    TodaysWorkers = _scheduleCollection.GetTodaysShifts(companyId, DateTime.Today)
                };
                return(View(model));
            }
        }
コード例 #2
0
        public IActionResult IndexEmployee()
        {
            string userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
            IndexEmployeeViewModel model = new IndexEmployeeViewModel()
            {
                CompanyID     = _companyHandler.GetCompanyFromUser(userId).CompanyId,
                Schedules     = _scheduleCollection.GetSchedulesFromCompany(_companyHandler.GetCompanyFromUser(userId).CompanyId),
                Shifts        = _shiftCollection.GetShiftsFromUser(userId),
                TodaysWorkers = _scheduleCollection.GetTodaysShifts(_companyHandler.GetCompanyFromUser(userId).CompanyId, DateTime.Today)
            };

            return(View(model));
        }