public async Task <IActionResult> Performer(int id) { var settings = await _performerSchedulingService.GetSettingsAsync(); var schedulingStage = _performerSchedulingService.GetSchedulingStage(settings); if (schedulingStage < PsSchedulingStage.SchedulingPreview) { return(RedirectToAction(nameof(Index))); } var performer = new PsPerformer(); try { performer = await _performerSchedulingService.GetPerformerByIdAsync(id, includeImages : true, includePrograms : true, includeSchedule : true, onlyApproved : true); } catch (GraException gex) { ShowAlertDanger("Unable to view performer: ", gex); return(RedirectToAction(nameof(Performers))); } var system = await _performerSchedulingService .GetSystemWithoutExcludedBranchesAsync(GetId(ClaimType.SystemId)); var viewModel = new PerformerViewModel { AgeGroups = await _performerSchedulingService .GetPerformerAgeGroupsAsync(performer.Id), BlackoutDates = await _performerSchedulingService.GetBlackoutDatesAsync(), Performer = performer, Settings = settings, System = system }; if (!performer.AllBranches) { viewModel.BranchAvailability = await _performerSchedulingService .GetPerformerBranchIdsAsync(performer.Id, system.Id); } if (performer.Images.Count > 0) { viewModel.ImagePath = _pathResolver.ResolveContentPath( performer.Images[0].Filename); } if (!string.IsNullOrWhiteSpace(performer.Website) && Uri.TryCreate(performer.Website, UriKind.Absolute, out Uri absoluteUri)) { viewModel.Uri = absoluteUri; } var performerIndexList = await _performerSchedulingService .GetPerformerIndexListAsync(true); var index = performerIndexList.IndexOf(id); viewModel.ReturnPage = (index / PerformersPerPage) + 1; if (index != 0) { viewModel.PrevPerformer = performerIndexList[index - 1]; } if (performerIndexList.Count != index + 1) { viewModel.NextPerformer = performerIndexList[index + 1]; } return(View(viewModel)); }