public static accountDetails GetAccountDetails() { accountDetails tempDetails = new accountDetails(); var username = getUsername(); var password = getPassword(); tempDetails.Username = username; tempDetails.Password = password; return(tempDetails); }
public IActionResult DepositStatus(accountDetails ob4) { _log4net.Info("Deposition status"); var database = new ViewDepositResponse(); try { database.AccId = ob4.accountId; database.AccBal = ob4.accountBalance; database.DepositStatus = ob4.accountType; db.viewDepositResponses.Add(database); db.SaveChanges(); return(View(ob4)); } catch (Exception) { return(BadRequest()); } }
public IActionResult Deposit(transactionInput accountBalance) { string data = JsonConvert.SerializeObject(accountBalance); StringContent content = new StringContent(data, Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync(client.BaseAddress + "/Account/deposit/", content).Result; if (response.IsSuccessStatusCode) { string data1 = response.Content.ReadAsStringAsync().Result; accountDetails ob4 = JsonConvert.DeserializeObject <accountDetails>(data1); if (ob4 != null) { return(RedirectToAction("DepositStatus", "Customer", ob4)); } else { return(RedirectToAction("Error")); } } return(BadRequest("Link Failure")); }
public ruleStatus evaluateMinBal(transactionInput value) { accountDetails ob = new accountDetails(); ruleStatus ob1 = new ruleStatus(); HttpResponseMessage response = client.GetAsync(client.BaseAddress + "/Account/getAccount/" + value.accountId).Result; if (response.IsSuccessStatusCode) { string data = response.Content.ReadAsStringAsync().Result; ob = JsonConvert.DeserializeObject <accountDetails>(data); ob.accountBalance = ob.accountBalance - value.balance; if (ob.accountBalance < 500) { ob1.message = "Warning"; } else { ob1.message = "No Warning"; } } return(ob1); }
public accountDetails getAccount(int id) { if (id % 2 != 0) { var ca = currentAccounts.Find(a => a.currentAccountId == id); var ac1 = new accountDetails { accountId = ca.currentAccountId, accountType = "Current Account", accountBalance = ca.currentAccountBalance }; return(ac1); } var sa = savingsAccounts.Where(a => a.savingsAccountId == id).FirstOrDefault(); accountDetails ac = new accountDetails { accountId = sa.savingsAccountId, accountType = "Savings Account", accountBalance = sa.savingsAccountbalance }; return(ac); }
public accountDetails deposit(transactionInput value) { string data = JsonConvert.SerializeObject(value); StringContent content = new StringContent(data, Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync(client.BaseAddress + "/Transaction/deposit/", content).Result; if (response.IsSuccessStatusCode) { string data1 = response.Content.ReadAsStringAsync().Result; Ts s1 = JsonConvert.DeserializeObject <Ts>(data1); if (s1.Message == "Success") { if (value.accountId % 2 == 0) { var sa = savingsAccounts.Find(a => a.savingsAccountId == value.accountId); sa.savingsAccountbalance = sa.savingsAccountbalance + value.balance; accountDetails sob = new accountDetails { accountId = value.accountId, accountType = "Deposited Correctly", accountBalance = sa.savingsAccountbalance }; return(sob); } var ca = currentAccounts.Find(a => a.currentAccountId == value.accountId); ca.currentAccountBalance = ca.currentAccountBalance + value.balance; accountDetails cob = new accountDetails { accountId = value.accountId, accountType = "Deposited Correctly", accountBalance = ca.currentAccountBalance }; return(cob); } } return(null); }
public accountDetails withdraw(transactionInput value) { string data = JsonConvert.SerializeObject(value); StringContent content = new StringContent(data, Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync(client.BaseAddress + "/Transaction/withdraw/", content).Result; if (response.IsSuccessStatusCode) { string data1 = response.Content.ReadAsStringAsync().Result; Ts s1 = JsonConvert.DeserializeObject <Ts>(data1); accountDetails amsg = new accountDetails(); if (s1.Message == "No Warning") { if (value.accountId % 2 == 0) { var sa = savingsAccounts.Find(a => a.savingsAccountId == value.accountId); sa.savingsAccountbalance = sa.savingsAccountbalance - value.balance; if (sa.savingsAccountbalance >= 0) { amsg.accountId = value.accountId; amsg.accountType = "Withdrawn Successfully"; amsg.accountBalance = sa.savingsAccountbalance; return(amsg); } else { sa.savingsAccountbalance = sa.savingsAccountbalance + value.balance; amsg.accountId = value.accountId; amsg.accountType = "Insufficient Fund"; amsg.accountBalance = sa.savingsAccountbalance; return(amsg); } } var car = currentAccounts.Find(a => a.currentAccountId == value.accountId); car.currentAccountBalance = car.currentAccountBalance - value.balance; if (car.currentAccountBalance >= 0) { amsg.accountId = value.accountId; amsg.accountType = "Withdrawn Successfully"; amsg.accountBalance = car.currentAccountBalance; return(amsg); } else { car.currentAccountBalance = car.currentAccountBalance + value.balance; amsg.accountId = value.accountId; amsg.accountType = "Insufficient Fund"; amsg.accountBalance = car.currentAccountBalance; return(amsg); } } if (value.accountId % 2 == 0) { var sa = savingsAccounts.Find(a => a.savingsAccountId == value.accountId); sa.savingsAccountbalance = sa.savingsAccountbalance - value.balance; if (sa.savingsAccountbalance >= 0) { amsg.accountId = value.accountId; amsg.accountType = "Withdrawn Successfully.Service charge applicable at the end of month"; amsg.accountBalance = sa.savingsAccountbalance; return(amsg); } else { sa.savingsAccountbalance = sa.savingsAccountbalance + value.balance; amsg.accountId = value.accountId; amsg.accountType = "Insufficient Fund"; amsg.accountBalance = sa.savingsAccountbalance; return(amsg); } } var ca = currentAccounts.Find(a => a.currentAccountId == value.accountId); ca.currentAccountBalance = ca.currentAccountBalance - value.balance; if (ca.currentAccountBalance >= 0) { amsg.accountId = value.accountId; amsg.accountType = "Withdrawn Successfully.Service Charge Applicable at the end of month"; amsg.accountBalance = ca.currentAccountBalance; return(amsg); } else { ca.currentAccountBalance = ca.currentAccountBalance + value.balance; amsg.accountId = value.accountId; amsg.accountType = "Insufficient Fund"; amsg.accountBalance = ca.currentAccountBalance; return(amsg); } } return(null); }