public async Task <long> CreateApprenticeship(long accountId, long commitmentId, Apprenticeship.ApprenticeshipRequest apprenticeshipRequest) { _logger.Trace($"Creating apprenticeship for commitment {commitmentId} for employer account {accountId}", accountId: accountId, commitmentId: commitmentId); apprenticeshipRequest.Apprenticeship.CommitmentId = commitmentId; var id = await _mediator.SendAsync(new CreateApprenticeshipCommand { Caller = new Caller { CallerType = CallerType.Employer, Id = accountId }, CommitmentId = commitmentId, Apprenticeship = _apprenticeshipMapper.Map(apprenticeshipRequest.Apprenticeship, CallerType.Employer), UserId = apprenticeshipRequest.UserId, UserName = apprenticeshipRequest.LastUpdatedByInfo?.Name }); _logger.Info($"Created apprenticeship {id} for commitment {commitmentId} for employer account {accountId}", accountId: accountId, commitmentId: commitmentId, apprenticeshipId: id); return(id); }
public async Task CreateApprenticeships(long providerId, long commitmentId, BulkApprenticeshipRequest bulkRequest) { _logger.Trace($"Bulk uploading {bulkRequest.Apprenticeships?.Count ?? 0} apprenticeships for commitment {commitmentId} for provider {providerId}", providerId: providerId, commitmentId: commitmentId); await _mediator.SendAsync(new BulkUploadApprenticeshipsCommand { Caller = new Caller(providerId, CallerType.Provider), CommitmentId = commitmentId, Apprenticeships = bulkRequest.Apprenticeships.Select(x => _apprenticeshipMapper.Map(x, CallerType.Provider)), UserId = bulkRequest.UserId, UserName = bulkRequest.LastUpdatedByInfo?.Name }); _logger.Info($"Bulk uploaded {bulkRequest.Apprenticeships?.Count} apprenticeships for commitment {commitmentId} for provider {providerId}", providerId: providerId, commitmentId: commitmentId, recordCount: bulkRequest.Apprenticeships?.Count); }