예제 #1
0
        public void Arrange()
        {
            _mediator = new Mock <IMediator>();

            _controller = new TransferConnectionInvitationsController(null, _mediator.Object);

            _viewModel = new ReceiveTransferConnectionInvitationViewModel
            {
                TransferConnectionInvitationId = TransferConnectionId
            };
        }
        public async Task <ActionResult> Receive(ReceiveTransferConnectionInvitationViewModel model)
        {
            switch (model.Choice)
            {
            case "Approve":
                await _mediator.SendAsync(new ApproveTransferConnectionInvitationCommand { AccountId = model.AccountId, AccountHashedId = model.AccountHashedId, UserRef = model.UserRef, TransferConnectionInvitationId = model.TransferConnectionInvitationId });

                return(RedirectToAction("Approved", new { transferConnectionInvitationId = model.TransferConnectionInvitationId }));

            case "Reject":
                await _mediator.SendAsync(new RejectTransferConnectionInvitationCommand { AccountId = model.AccountId, AccountHashedId = model.AccountHashedId, UserRef = model.UserRef, TransferConnectionInvitationId = model.TransferConnectionInvitationId });

                return(RedirectToAction("Rejected", new { transferConnectionInvitationId = model.TransferConnectionInvitationId }));

            default:
                throw new ArgumentOutOfRangeException(nameof(model.Choice));
            }
        }