public ActionResult Post([FromBody] AccountCommandInput command) { var result = _accountFlows.AddAccount(command); if (result.IsValid()) { return(Ok(result)); } return(BadRequest(result.GetErrors())); }
public Account AddAccount(AccountCommandInput commandInput) { var account = new Account(commandInput.Name, commandInput.Type.Code, commandInput.InitialBalance); if (account.IsValid()) { _accountRepository.Insert(account); } return(account); }