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()); }
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()); }
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)); }
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))); }