Skip to content

Instantly share code, notes, and snippets.

@DmitrySikorsky
Created July 13, 2019 09:13
Show Gist options
  • Save DmitrySikorsky/17d171f3c5dea45914cc604a216b257b to your computer and use it in GitHub Desktop.
Save DmitrySikorsky/17d171f3c5dea45914cc604a216b257b to your computer and use it in GitHub Desktop.
public IEnumerable<LocalizedBook> GetAll(string cultureCode)
{
return this.storage.Books.Select(
b => new LocalizedBook()
{
Id = b.Id,
Name = b.Name.Localizations.FirstOrDefault(l => l.CultureCode == cultureCode).Value,
Description = b.Description.Localizations.FirstOrDefault(l => l.CultureCode == cultureCode).Value,
Author = b.Author.Localizations.FirstOrDefault(l => l.CultureCode == cultureCode).Value,
Year = b.Year
}
).ToList();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment