public async Task <IEnumerable <Bocker> > GetBooks() { var utf8 = Encoding.UTF8; var url = "https://raw.githubusercontent.com/contribe/contribe/dev/arbetsprov-net/books.json"; var books = BookSource._download_json <CListBooks>(url); var V = books.books; foreach (var item in V) { byte[] bytes = Encoding.Default.GetBytes(item.Title); string sTitle = Encoding.UTF8.GetString(bytes); Bocker b = new Bocker { Author = item.Author, InStock = item.InStock, Price = item.Price, Title = sTitle }; lstBook.Add(b); } return(lstBook); }
public async Task <IEnumerable <Bocker> > GetBook(string search) { var url = "https://raw.githubusercontent.com/contribe/contribe/dev/arbetsprov-net/books.json"; var books = BookSource._download_json <CListBooks>(url); var V = books.books; foreach (var item in V) { Bocker b = new Bocker { Author = item.Author, InStock = item.InStock, Price = item.Price, Title = item.Title }; lstBook.Add(b); } //Nu söker vi var F = lstBook.FindAll(c => (c.Author == search) || (c.Title == search)); return(F); }