Nu har det tillkommit en source med data för demo

This commit is contained in:
2019-11-26 20:16:47 +01:00
parent 6d5fa6ae26
commit 879bd161a3
8 changed files with 2911 additions and 84 deletions

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Books.ConsoleApp
{
public class Search
{
public static IEnumerable<Book> ByTitle(IEnumerable<Book> books, string titlePartial)
{
var titlePartialLowercased = titlePartial.ToLower();
return books
.Where(b =>
{
var bookTitleLowercased = b.title.ToLower();
return bookTitleLowercased.Contains(titlePartialLowercased);
});
}
public static IEnumerable<Book> SuggestRandom(IEnumerable<Book> books, int count = 5)
{
throw new NotImplementedException();
}
}
}