private async Task <UsersSearchCriteriaModel> GetUserAgencyTypeAndIdWithFlags(UsersSearchCriteriaModel userSearchCriteriaModel) { if (User.IsInRole(RoleNames.MonafasatAdmin)) { userSearchCriteriaModel.isGovVendor = User.UserIsGovVendor(); userSearchCriteriaModel.isSemiGovAgency = User.UserIsSemiGovAgency(); if (User.UserIsVRO()) { userSearchCriteriaModel.AgencyType = (int)Enums.AgencyType.VRO; } else { userSearchCriteriaModel.AgencyType = userSearchCriteriaModel.isSemiGovAgency ? (int)AgencyType.SemiGovAgency : (userSearchCriteriaModel.isGovVendor ? (int)AgencyType.GovVendor : (int)AgencyType.Agency); } userSearchCriteriaModel.AgencyId = User.UserAgency(); } else {//Account manager + Customer service if (!string.IsNullOrEmpty(userSearchCriteriaModel.AgencyId)) { var agencyCategory = (await _iDMAppService.FindGovAgencyByIdAsync(userSearchCriteriaModel.AgencyId)).CategoryId; userSearchCriteriaModel.AgencyType = agencyCategory.Value;// agencyCategory == (int)IDMUserCategory.GovVendor ? (int)AgencyType.GovVendor : (agencyCategory == (int)IDMUserCategory.PrivateSector ? (int)AgencyType.SemiGovAgency : (int)AgencyType.Agency); } else { userSearchCriteriaModel.AgencyType = (int)AgencyType.None; } } return(userSearchCriteriaModel); }