Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //8.Author Search
- public static string GetAuthorNamesEndingIn(BookShopContext context, string input)
- {
- var books = context.Books.Where(b => b.Author.FirstName.EndsWith(input))
- .Select(b => new
- {
- AuthorFirstName = b.Author.FirstName,
- AthorLastName = b.Author.LastName,
- })
- .OrderBy(b=>b.AuthorFirstName)
- .ThenBy(b=>b.AthorLastName)
- .ToHashSet();
- return string.Join(Environment.NewLine, books.Select(b=>$"{b.AuthorFirstName} {b.AthorLastName}"));
- }
Advertisement
Add Comment
Please, Sign In to add comment