public async Task <IActionResult> Create([FromBody] CreateEmptyCohortRequest request)
        {
            var command = new AddEmptyCohortCommand(request.AccountId, request.AccountLegalEntityId, request.ProviderId, request.UserInfo);
            var result  = await _mediator.Send(command);

            return(Ok(new CreateCohortResponse
            {
                CohortId = result.Id,
                CohortReference = result.Reference
            }));
        }
Beispiel #2
0
        public async Task <AddCohortResult> Handle(long accountId, long accountLegalEntity, long providerId)
        {
            Db.SaveChanges();

            var command = new AddEmptyCohortCommand(accountId, accountLegalEntity, providerId, UserInfo);

            var handler = new AddEmptyCohortHandler(new Lazy <ProviderCommitmentsDbContext>(() => Db),
                                                    EncodingService,
                                                    Mock.Of <ILogger <AddEmptyCohortHandler> >(),
                                                    CohortDomainServiceMock.Object);

            var response = await handler.Handle(command, CancellationToken.None);

            await Db.SaveChangesAsync();

            return(response);
        }