1818 using Microsoft . FeatureManagement . Mvc ;
1919 using Microsoft . Extensions . Configuration ;
2020 using DigitalLearningSolutions . Data . Extensions ;
21- using Microsoft . AspNetCore . Http . Extensions ;
21+ using Microsoft . AspNetCore . Hosting ;
2222
2323 [ FeatureGate ( FeatureFlags . RefactoredTrackingSystem ) ]
2424 [ Authorize ( Policy = CustomPolicies . UserCentreAdmin ) ]
@@ -35,6 +35,7 @@ public class AllDelegatesController : Controller
3535 private readonly IUserDataService userDataService ;
3636 private readonly IGroupsService groupsService ;
3737 private readonly IConfiguration configuration ;
38+ private readonly IWebHostEnvironment env ;
3839
3940 public AllDelegatesController (
4041 IDelegateDownloadFileService delegateDownloadFileService ,
@@ -43,7 +44,8 @@ public AllDelegatesController(
4344 IJobGroupsDataService jobGroupsDataService ,
4445 IPaginateService paginateService ,
4546 IGroupsService groupsService ,
46- IConfiguration configuration
47+ IConfiguration configuration ,
48+ IWebHostEnvironment env
4749 )
4850 {
4951 this . delegateDownloadFileService = delegateDownloadFileService ;
@@ -53,6 +55,7 @@ IConfiguration configuration
5355 this . paginateService = paginateService ;
5456 this . groupsService = groupsService ;
5557 this . configuration = configuration ;
58+ this . env = env ;
5659 }
5760
5861 [ NoCaching ]
@@ -77,7 +80,8 @@ public IActionResult Index(
7780
7881 sortBy ??= DefaultSortByOptions . Name . PropertyName ;
7982 sortDirection ??= GenericSortingHelper . Ascending ;
80- if ( HttpContext . Request . GetDisplayUrl ( ) . ToString ( ) . ToLower ( ) . Contains ( "uat" ) )
83+
84+ if ( string . Equals ( env . EnvironmentName , "UAT" , StringComparison . OrdinalIgnoreCase ) )
8185 {
8286 DelegateFilterCookieName = "DelegateFilterUat" ;
8387 }
0 commit comments