Esempio n. 1
0
        public async Task <DAL.App.DTO.Location> FindForUserAsync(int id, int userId)
        {
            var Location = await RepositoryDbSet
                           .FirstOrDefaultAsync(m => m.Id == id && m.AppUserId == userId);

            return(LocationMapper.MapFromDomain(Location));
        }
Esempio n. 2
0
 public override async Task <List <DAL.App.DTO.Location> > AllAsync()
 {
     return(await RepositoryDbSet
            .Include(m => m.Locations)
            .ThenInclude(t => t.Translations)
            .Include(c => c.Shows)
            .Include(i => i.Competitions)
            .Select(e => LocationMapper.MapFromDomain(e)).ToListAsync());
 }
Esempio n. 3
0
        public override async Task <DTO.Location> FindAsync(params object[] id)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var location = await RepositoryDbSet.FindAsync(id);

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

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

            return(LocationMapper.MapFromDomain(location));
        }
Esempio n. 4
0
 public async Task <List <DAL.App.DTO.Location> > AllForUserAsync(int userId)
 {
     return(await RepositoryDbSet
            .Select(e => LocationMapper.MapFromDomain(e)).ToListAsync());
 }