Exemple #1
0
        public override async Task <Skill> FindAsync(params object[] id)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var skill = await RepositoryDbSet.FindAsync(id);

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

                await RepositoryDbContext.Entry(skill)
                .Reference(c => c.Description)
                .LoadAsync();

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

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

            return(SkillMapper.MapFromDomain(skill));
        }
Exemple #2
0
 public override async Task <List <DAL.App.DTO.Skill> > AllAsync()
 {
     return(await RepositoryDbSet
            .Include(m => m.SkillName)
            .ThenInclude(t => t.Translations)
            .Include(m => m.Description)
            .ThenInclude(t => t.Translations)
            .Select(e => SkillMapper.MapFromDomain(e)).ToListAsync());
 }