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

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

            var command = new AddCohortWithOtherPartyCommand(accountId, accountLegalEntity, providerId, transferSenderId, message, UserInfo);

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

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

            await Db.SaveChangesAsync();

            return(response);
        }