public async Task <BaseApiResponse> DelBankCard(DelRequest request) { request.CheckNotNull(nameof(request)); var currentAccount = _contextService.GetCurrentAccount(HttpContext.Current); var command = new RemoveBankCardCommand(currentAccount.WalletId.ToGuid(), request.Id); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }
public async Task <BaseApiResponse> DeleteBankCard(DeleteBankCardRequest request) { request.CheckNotNull(nameof(request)); TryInitUserModel(); var command = new RemoveBankCardCommand(_wallet.Id, request.BankCardId); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }
public void Handle(ICommandContext context, RemoveBankCardCommand command) { context.Get <Wallet>(command.AggregateRootId).RemoveBankCard(command.BankCardId); }