public async Task <OrchestratorResponse <ManageApprenticeshipsViewModel> > GetApprenticeships( string hashedAccountId, string externalUserId) { var accountId = _hashingService.DecodeValue(hashedAccountId); _logger.Info($"Getting On-programme apprenticeships for empployer: {accountId}"); return(await CheckUserAuthorization(async() => { var data = await _mediator.SendAsync(new GetAllApprenticeshipsRequest { AccountId = accountId }); var apprenticeships = data.Apprenticeships .OrderBy(m => m.ApprenticeshipName) .Select( m => _apprenticeshipMapper.MapToApprenticeshipDetailsViewModel(m)) .ToList(); var model = new ManageApprenticeshipsViewModel { HashedAccountId = hashedAccountId, Apprenticeships = apprenticeships }; return new OrchestratorResponse <ManageApprenticeshipsViewModel> { Data = model }; }, hashedAccountId, externalUserId)); }
public async Task <OrchestratorResponse <ApprenticeshipDetailsViewModel> > GetApprenticeship(string hashedAccountId, string hashedApprenticeshipId, string externalUserId) { var accountId = HashingService.DecodeValue(hashedAccountId); var apprenticeshipId = HashingService.DecodeValue(hashedApprenticeshipId); Logger.Info( $"Getting On-programme apprenticeships Provider: {accountId}, ApprenticeshipId: {apprenticeshipId}"); return(await CheckUserAuthorization(async() => { var data = await Mediator.SendAsync( new GetApprenticeshipQueryRequest { AccountId = accountId, ApprenticeshipId = apprenticeshipId }); var detailsViewModel = _apprenticeshipMapper.MapToApprenticeshipDetailsViewModel(data.Apprenticeship); detailsViewModel.PendingDataLockRestart = data.Apprenticeship.DataLockCourseTriaged; detailsViewModel.PendingDataLockChange = data.Apprenticeship.DataLockPriceTriaged || data.Apprenticeship.DataLockCourseChangeTriaged; return new OrchestratorResponse <ApprenticeshipDetailsViewModel> { Data = detailsViewModel }; }, hashedAccountId, externalUserId)); }