public ActionResult Deposit(Guid accountId) { var account = _bankAccountService.GetAccount(accountId); if (account != null && account.User == User.Identity.Name) { var transaction = new Transaction() { accountId = accountId }; return(View()); } FormsAuthentication.SignOut(); return(RedirectToAction("Login", "UserAccount")); }
public ActionResult <BankAccountModel> GetBankAccount(string accountId) { var account = _bankAccountService.GetAccount(accountId); if (account == null) { return(NotFound()); } return(BankAccountModel.FromDomain(account)); }
public List <Transaction> GetTransactions(Guid accountId) { var headers = HttpContext.Current.Request.Headers; var username = GetUsernameFromAuthHeader(headers["Authorization"]); var account = new BankAccount(); var transactions = new List <Transaction>(); if (accountId != null) { account = _bankAccountService.GetAccount(accountId); } if (account != null && account.User == username) { transactions = account.Transactions; } return(transactions); }
public void getAccountByIdValidTest() { BankAccount account = _bankAccountService.CreateAccount(new BankAccount(100, "TestUser")); var returnedAccount = _bankAccountService.GetAccount(account.Id); Assert.IsNotNull(returnedAccount); Assert.IsInstanceOf(typeof(BankAccount), returnedAccount); Assert.AreEqual(account.Id, returnedAccount.Id); }