public IActionResult Books(string category) { APIHandler webHandler = new APIHandler(); Rootobject books = webHandler.GetBooks(category); return(View(books)); }
public IActionResult ViewChart(string category) { APIHandler webHandler = new APIHandler(); Rootobject books = webHandler.GetBooks(category); List <DataPoint> dataPoints = new List <DataPoint>(); if (books != null) { for (int i = 0; i < books.results.books.Count(); i++) { dataPoints.Add(new DataPoint(books.results.books[i].rank, books.results.books[i].weeks_on_list)); } } ViewBag.DataPoints = JsonConvert.SerializeObject(dataPoints); return(View(books)); }