Exemplo n.º 1
0
 public override async Task <List <DAL.App.DTO.Material> > AllAsync()
 {
     return(await RepositoryDbSet
            .Include(m => m.MaterialName)
            .ThenInclude(t => t.Translations)
            .Include(c => c.Schoolings)
            .Select(e => MaterialMapper.MapFromDomain(e)).ToListAsync());
 }
Exemplo n.º 2
0
        public override async Task <DTO.Material> FindAsync(params object[] id)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var material = await RepositoryDbSet.FindAsync(id);

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

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

            return(MaterialMapper.MapFromDomain(material));
        }