Advertisement
simeon3000

GetBooksReleasedBefore

Nov 21st, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1.         public static string GetBooksReleasedBefore(BookShopContext context, string date) //06.
  2.         {
  3.             DateTime inputDate = DateTime.ParseExact(date, "dd-MM-yyyy", null);
  4.             var result = context.Books
  5.                 .Where(b => b.ReleaseDate < inputDate)
  6.                 .OrderByDescending(b => b.ReleaseDate)
  7.                 .Select(b => $"{b.Title} - {b.EditionType} - ${b.Price}:f2"); //added :f2
  8.             return string.Join(Environment.NewLine, result);
  9.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement