Exemplo n.º 1
0
        public async Task <SongResult> GetSongById(Guid id)
        {
            var query = from song in _context.Set <Song>()
                        join alSo in _context.Set <AlbumSong>() on song.Id equals alSo.SongId
                        join album in _context.Set <Album>() on alSo.AlbumId equals album.Id
                        join band in _context.Set <Band>() on album.BandId equals band.Id
                        where song.Id == id
                        select new SongResult
            {
                Song     = song,
                Album    = album,
                Band     = band,
                Position = alSo.Position
            };

            return(await query.FirstOrDefaultAsync().ConfigureAwait(false));
        }
Exemplo n.º 2
0
 public Task <User> GetById(Guid id)
 {
     return(_context.Set <User>()
            .Include(x => x.Subscriptions)
            .FirstOrDefaultAsync(x => x.Id == id));
 }
Exemplo n.º 3
0
 public Band CreateBand(Band band)
 {
     return(_context.Set <Band>().Add(band).Entity);
 }
 public Playlist Create(Playlist playlist)
 {
     return(_context.Set <Playlist>().Add(playlist).Entity);
 }
Exemplo n.º 5
0
 public Task <bool> Exists(Guid id)
 {
     return(_context.Set <Album>().AnyAsync(x => x.Id == id));
 }
Exemplo n.º 6
0
 public Subscription Create(Subscription subscription)
 {
     return(_context.Set <Subscription>().Add(subscription).Entity);
 }