Advertisement
Danny_Berova

03.GetBooksByPrice

Nov 21st, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.39 KB | None | 0 0
  1. public static string GetBooksByPrice(BookShopContext db)
  2.         {
  3.             var booksByPrice = db.Books
  4.                 .OrderByDescending(b => b.Price)
  5.                 .Where(b => b.Price > 40)
  6.                 .Select(b => $"{b.Title} - ${b.Price}")
  7.                 .ToList();
  8.  
  9.             var result = String.Join(Environment.NewLine, booksByPrice);
  10.             return result;
  11.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement