public async Task <IActionResult> Create([FromBody] CreateCohortRequest request) { var command = new AddCohortCommand( request.AccountId, request.AccountLegalEntityId, request.ProviderId, request.CourseCode, request.Cost, request.StartDate, request.EndDate, request.OriginatorReference, request.ReservationId, request.FirstName, request.LastName, request.DateOfBirth, request.Uln, request.TransferSenderId, request.UserInfo); var result = await _mediator.Send(command); return(Ok(new CreateCohortResponse { CohortId = result.Id, CohortReference = result.Reference })); }
public async Task <AddCohortResult> Handle(long accountId, long accountLegalEntity, long providerId, long?transferSenderId, string courseCode) { Db.SaveChanges(); var command = new AddCohortCommand( accountId, accountLegalEntity, providerId, courseCode, null, null, null, null, null, null, null, null, null, transferSenderId, UserInfo); var handler = new AddCohortHandler(new Lazy <ProviderCommitmentsDbContext>(() => Db), EncodingService, Logger, DraftApprenticeshipDetailsMapperMock.Object, CohortDomainServiceMock.Object); var response = await handler.Handle(command, CancellationToken.None); await Db.SaveChangesAsync(); return(response); }