示例#1
0
        public override async Task <DAL.App.DTO.AppUserInPosition> FindAsync(params object[] id)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var workerInPosition = await RepositoryDbSet.FindAsync(id);

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

                await RepositoryDbContext.Entry(workerInPosition.AppUserPosition)
                .Reference(c => c.AppUserPositionValue)
                .LoadAsync();

                await RepositoryDbContext.Entry(workerInPosition.AppUserPosition.AppUserPositionValue)
                .Collection(c => c.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();

                await RepositoryDbContext.Entry(workerInPosition)
                .Reference(c => c.AppUser)
                .LoadAsync();
            }

            return(AppUserInPositionMapper.MapFromDomain(workerInPosition));
        }
 public async Task <List <AppUserInPosition> > AllForUserAsync(int userId)
 {
     return((await Uow.AppUsersInPositions
             .AllForUserAsync(userId))
            .Select(e => AppUserInPositionMapper
                    .MapFromDAL(e)).ToList());
 }
示例#3
0
 public override async Task <List <DAL.App.DTO.AppUserInPosition> > AllAsync()
 {
     return(await RepositoryDbSet
            .Include(p => p.AppUserPosition)
            .ThenInclude(p => p.AppUserPositionValue)
            .ThenInclude(t => t.Translations)
            .Include(p => p.AppUser)
            .Select(e => AppUserInPositionMapper.MapFromDomain(e))
            .ToListAsync());
 }
示例#4
0
        public async Task <AppUserInPosition> FindForUserAsync(int id, int userId)
        {
            var appUserInPosition = await RepositoryDbSet
                                    .Include(c => c.AppUserPosition)
                                    .ThenInclude(p => p.AppUserPositionValue)
                                    .ThenInclude(t => t.Translations)
                                    .Include(c => c.AppUser)
                                    .FirstOrDefaultAsync(m => m.Id == id && m.AppUser.Id == userId);

            return(AppUserInPositionMapper.MapFromDomain(appUserInPosition));
        }
示例#5
0
 public async Task <List <DAL.App.DTO.AppUserInPosition> > AllForUserAsync(int userId)
 {
     return(await RepositoryDbSet
            .Include(c => c.AppUserPosition)
            .ThenInclude(p => p.AppUserPositionValue)
            .ThenInclude(t => t.Translations)
            .Include(c => c.AppUser)
            .Where(c => c.AppUser.Id == userId)
            .Select(e => AppUserInPositionMapper.MapFromDomain(e))
            .ToListAsync());
 }
 public async Task <AppUserInPosition> FindForUserAsync(int id, int userId)
 {
     return(AppUserInPositionMapper.MapFromDAL(await Uow.AppUsersInPositions.FindForUserAsync(id, userId)));
 }