Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string GetBooksByAgeRestriction(BookShopContext context,string command)
- {
- int restriction =(int)(AgeRestriction)Enum.Parse(typeof(AgeRestriction),command.ToLower(),ignoreCase:true);
- var bookTitles = context.Books
- .Where(x =>x.AgeRestriction==(AgeRestriction)restriction)
- .Select(x=>x.Title)
- .OrderBy(x=>x).ToArray();
- string output = string.Join(Environment.NewLine, bookTitles);
- return output;
- }
Advertisement
Add Comment
Please, Sign In to add comment