public async Task <IActionResult> Post([FromBody] RegisterRequest request) { RegisterResult result = await registerService.Execute( request.Personnummer, request.Name, request.InitialAmount); List <TransactionModel> transactions = new List <TransactionModel>(); foreach (var item in result.Account.Transactions) { var transaction = new TransactionModel( item.Amount, item.Description, item.TransactionDate); transactions.Add(transaction); } AccountDetailsModel account = new AccountDetailsModel( result.Account.AccountId, result.Account.CurrentBalance, transactions); List <AccountDetailsModel> accounts = new List <AccountDetailsModel>(); accounts.Add(account); Model model = new Model( result.Customer.CustomerId, result.Customer.Personnummer, result.Customer.Name, accounts ); return(CreatedAtRoute("GetCustomer", new { customerId = model.CustomerId }, model)); }
public async Task <IActionResult> Post([FromBody] RegisterRequest request) { RegisterOutput output = await _registerUseCase.Execute(request.Personnummer, request.Name, request.InitialAmount); _presenter.Populate(output); return(_presenter.ViewModel); }
public async Task <IActionResult> Register([FromBody] RegistrationRequest request) { var input = new RegistrationInput(request.UserName, request.Password, request.Email); await _useCase.Execute(input); return(_presenter.ViewModel); }
public async void Register() { Console.WriteLine("\nEnter Username:\n"); var username = Console.ReadLine(); Console.WriteLine("\nEnter Password:\n"); var password = Console.ReadLine(); var registerOutput = await _registerUseCase.Execute(username, password); }
public async Task <IActionResult> Register(RegisterRequest request) { if (!ModelState.IsValid) { return(View()); } RegisterOutput output = await _registerUseCase.Execute( request.Personnummer, request.Name, request.InitialAmount); _presenter.Populate(output); return(_presenter.ViewModel); }