Пример #1
0
 public override async Task <List <DAL.App.DTO.Breed> > AllAsync()
 {
     return(await RepositoryDbSet
            .Include(m => m.BreedName)
            .ThenInclude(t => t.Translations)
            .Include(c => c.Dogs)
            .Select(e => BreedMapper.MapFromDomain(e)).ToListAsync());
 }
Пример #2
0
        public override async Task <DTO.Breed> FindAsync(params object[] id)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var breed = await RepositoryDbSet.FindAsync(id);

            if (breed != null)
            {
                await RepositoryDbContext.Entry(breed)
                .Reference(c => c.BreedName)
                .LoadAsync();

                await RepositoryDbContext.Entry(breed.BreedName)
                .Collection(b => b.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();
            }

            return(BreedMapper.MapFromDomain(breed));
        }