public IActionResult GetCustomerAccountDetails(customerId cid) { _log4net.Info("Details of a particular customer initiated"); return(RedirectToAction("AccountStatus", cid)); /*int acid = cid.id; * //var ac = new List<AccountMsg>(); * HttpResponseMessage response = client.GetAsync("https://localhost:44379/api/Account/getCustomerAccounts/" + acid).Result; * if (response.IsSuccessStatusCode) * { * string data = response.Content.ReadAsStringAsync().Result; * List<AccountMsg> ac = JsonConvert.DeserializeObject<List<AccountMsg>>(data); * return RedirectToAction("AccountStatus", ac); * } * return BadRequest();*/ }
public IActionResult AccountStatus(customerId custId) { //List<AccountMsg> abc = ac; _log4net.Info("Customer Details generated"); int clientId = custId.id; var database = new ViewAccountDetailsResponse(); HttpResponseMessage response = client.GetAsync("https://localhost:44379/api/Account/getCustomerAccounts/" + clientId).Result; if (response.IsSuccessStatusCode) { string data = response.Content.ReadAsStringAsync().Result; List <accountDetails> ac = JsonConvert.DeserializeObject <List <accountDetails> >(data); if (ac != null) { try { foreach (var v in ac) { database.AccId = v.accountId; database.AccBal = v.accountBalance; database.AccType = v.accountType; db.viewAccountDetailsResponses.Add(database); } db.SaveChanges(); return(View(ac)); } catch (Exception) { return(BadRequest()); } } else { return(RedirectToAction("Error")); } } return(BadRequest("Link Failure")); }