Ejemplo n.º 1
0
        public IActionResult CreateNewAccount(CreateAccounViewModel model)
        {
            IAccountCollection accountCollection = _accountFactory.AccountCollection();

            accountCollection.CreateAccount(new Account(model.Name, model.Password, model.IsActive));
            return(RedirectToAction("Index", "Account"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> CreateAccount(CreateAccounViewModel accountModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(View(accountModel));
            }
            try
            {
                var account = await this.accountService.RegisterAccountAsync(/*accountModel.AccountNumber,*/
                                                                             /* accountModel.Nickname,*/ accountModel.Balance, accountModel.ClientId);


                return(Json(accountModel));
            }
            catch (ArgumentException ex)
            {
                this.ModelState.AddModelError("Error", ex.Message);
                return(View(accountModel));
            }
        }