Created
May 7, 2020 01:44
-
-
Save StefanRiedmann/f34fd002b5bca2716fea3d4f38960e47 to your computer and use it in GitHub Desktop.
Read and print Garden summaries for a list of years.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void ReadGardenInfos(GardenContext db, params int[] years) | |
{ | |
var gardenInfos = db.GardenInfos.AsNoTracking() | |
.Include(gi => gi.Garden) | |
.Where(gi => years.Contains(gi.Year)) | |
.OrderBy(gi => gi.Garden.Name).ThenBy(gi => gi.Year) | |
.ToList(); | |
gardenInfos.ForEach(info => Console.WriteLine($"Crops in '{info.Garden.Name}' ({info.Year}): {info.AllGardenCrops}")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment