Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main()
- {
- using (var db = new BookShopContext())
- {
- DbInitializer.ResetDatabase(db);
- string command = Console.ReadLine().ToLower();
- GetBooksByAgeRestriction(db, command);
- }
- }
- public static string GetBooksByAgeRestriction(BookShopContext context, string command)
- {
- //string currentEnum = Enum.Parse(typeof(AgeRestriction), command, true).ToString();
- var books = context.Books
- .Where(x => x.AgeRestriction.ToString().ToLower().Equals(command))
- .OrderBy(x => x.Title)
- .ToList();
- return string.Join(Environment.NewLine, books);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement