public static Account Create(AccountCreateArgs args) { Account account = new Account { AccountId = Guid.NewGuid(), AccountCode = args.AccountCode, AccountName = args.AccountName, AccountDescription = args.AccountDescription, ParentAccountId = args.ParentAccountId, DebitOrCredit = args.DebitOrCredit, IsHidden = args.IsHidden }; return(account); }
public async Task <ActionResult <AccountCreateResponse> > Create([FromBody] AccountCreateRequest request) { request.EnsureValidation(); AccountCreateArgs accountCreateArgs = new AccountCreateArgs { AccountCode = request.Code, AccountName = request.Name, AccountDescription = request.Description, ParentAccountId = request.ParentId, DebitOrCredit = request.DebitOrCredit, IsHidden = request.IsHidden }; IMediator mediator = Factory.Resolve <IMediator>(); AccountCreateResult accountCreateResult = await mediator.Send(new AccountCreateCommand(accountCreateArgs)); accountCreateResult.EnsureSuccess(); AccountCreateResponse response = new AccountCreateResponse { IsSuccess = true }; return(Ok(response)); }
public AccountCreateCommand(AccountCreateArgs args) { Args = args; }