public List <CustomerPriceDetails> getCustomers() { List <CustomerPriceDetails> cpl = new List <CustomerPriceDetails>(); CustomerPriceMethods cpm = new CustomerPriceMethods(); cpl = cpm.GetCustomerPrice(out string errormsg); return(cpl); }
//RÄKNA UT PRIS public async Task <IActionResult> AveragePrice() { List <CustomerPriceDetails> Customers = new List <CustomerPriceDetails>(); HttpClient client = _api.Initial(); HttpResponseMessage res = await client.GetAsync("api/Values"); if (res.IsSuccessStatusCode) { var result = res.Content.ReadAsStringAsync().Result; Customers = JsonConvert.DeserializeObject <List <CustomerPriceDetails> >(result); } CustomerPriceMethods cpm = new CustomerPriceMethods(); int price = cpm.GetAveragePrice(Customers); TempData["price"] = price; return(RedirectToAction("Index")); }