public async Task <IActionResult> oauth(string code) { var acctModel = new accountModel(); var bankInfo = _sEBAccountAuthService.GetBankBysandBoxID("9311219639"); acctModel.BankName = "SEB"; acctModel.BankAccountNumber = bankInfo.AccountNumber; acctModel.BankAccountName = bankInfo.AccountName; acctModel.Currency = bankInfo.Currency; acctModel.AccountType = bankInfo.AccountType; acctModel.Balance = bankInfo.AccountBalance; acctModel.TotalExpense = bankInfo.TotalExpenses; acctModel.TotalIncome = bankInfo.TotalIncome; acctModel.SandboxIdentification = bankInfo.SandboxIdentification; acctModel.CreatedAt = DateTime.Now; acctModel.User = await _userManager.GetUserAsync(HttpContext.User); acctModel.TransactionLimit = 15.0M; _context.AccountModels.Add(acctModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Dashboard))); }
public ActionResult Index(login login) { bool res = new accountModel().login(login.username, Encryptor.MD5Hash(login.pass)); if (ModelState.IsValid && res) { FormsAuthentication.SetAuthCookie(login.username, login.rememberMe); ViewBag.username = login.username; return(RedirectToAction("index", "home")); } else { ModelState.AddModelError("", "Tên đăng nhập hoặc mật khẩu không đúng. Vui lòng kiểm tra lại!"); } return(View(login)); }
public async Task <IActionResult> addBank(accountViewModel model) { var acctModel = new accountModel(); //string accountId = "ACC _ID_" + model.acctNumber; if (model.bankName.ToLower() == "seb") { TempData["accountnumber"] = model.acctNumber; var redirecturl = _sEBAccountAuthService.AuthRedirectUrl(); return(Redirect(redirecturl)); } else { var bankInfo = _medBankServices.GetAccountInfoById(model.acctNumber).Result; acctModel.BankName = model.bankName; acctModel.BankAccountNumber = bankInfo.AccountNumber; acctModel.BankAccountName = bankInfo.AccountName; acctModel.Currency = bankInfo.Currency; acctModel.AccountType = bankInfo.AccountType; acctModel.Balance = bankInfo.AccountBalance; acctModel.TotalExpense = bankInfo.TotalExpenses; acctModel.TotalIncome = bankInfo.TotalIncome; acctModel.SandboxIdentification = bankInfo.SandboxIdentification; acctModel.CreatedAt = DateTime.Now; acctModel.User = await _userManager.GetUserAsync(HttpContext.User); acctModel.TransactionLimit = model.transactionLimit; _context.AccountModels.Add(acctModel); await _context.SaveChangesAsync(); } return(RedirectToAction(nameof(Dashboard))); }