Example #1
0
 public async Task <List <Schooling> > AllForMaterialAsync(int materialId)
 {
     return(await RepositoryDbSet
            .Include(a => a.Material)
            .Include(a => a.SchoolingName)
            .ThenInclude(a => a.Translations)
            .Where(a => a.MaterialId == materialId)
            .Select(e => SchoolingMapper.MapFromDomain(e))
            .ToListAsync());
 }
Example #2
0
        public override async Task <List <DAL.App.DTO.Schooling> > AllAsync()
        {
            return(await RepositoryDbSet
                   .Include(m => m.SchoolingName)
                   .ThenInclude(t => t.Translations)
                   .Include(m => m.Material)
                   .ThenInclude(a => a.MaterialName)
                   .ThenInclude(t => t.Translations)
                   .Include(a => a.Location)
                   .ThenInclude(a => a.Locations)
                   .ThenInclude(a => a.Translations)

                   .Select(e => SchoolingMapper.MapFromDomain(e)).ToListAsync());
        }
Example #3
0
        public override async Task <DTO.Schooling> FindAsync(params object[] id)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var schooling = await RepositoryDbSet.FindAsync(id);

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

                await RepositoryDbContext.Entry(schooling.SchoolingName)
                .Collection(b => b.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();

                await RepositoryDbContext.Entry(schooling)
                .Reference(c => c.Material)
                .LoadAsync();

                await RepositoryDbContext.Entry(schooling.Material)
                .Reference(c => c.MaterialName)
                .LoadAsync();

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

                await RepositoryDbContext.Entry(schooling)
                .Reference(c => c.Location)
                .LoadAsync();

                await RepositoryDbContext.Entry(schooling.Location)
                .Reference(c => c.Locations)
                .LoadAsync();

                await RepositoryDbContext.Entry(schooling.Location.Locations)
                .Collection(b => b.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();
            }

            return(SchoolingMapper.MapFromDomain(schooling));
        }