Пример #1
0
        public async Task <IActionResult> Schedule(int id)
        {
            var settings = await _performerSchedulingService.GetSettingsAsync();

            var schedulingStage = _performerSchedulingService.GetSchedulingStage(settings);

            if (schedulingStage < PsSchedulingStage.SchedulePosted)
            {
                return(RedirectToAction(nameof(Index)));
            }

            var branch = await _performerSchedulingService.GetNonExcludedBranch(id);

            if (branch == null)
            {
                return(RedirectToAction(nameof(Index)));
            }

            branch.Selections = await _performerSchedulingService
                                .GetSelectionsByBranchIdAsync(branch.Id);

            var viewModel = new ScheduleViewModel
            {
                Settings = settings,
                Branch   = branch
            };

            return(View(viewModel));
        }