示例#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));
        }
示例#2
0
 public Task <User> GetById(Guid id)
 {
     return(_context.Set <User>()
            .Include(x => x.Subscriptions)
            .FirstOrDefaultAsync(x => x.Id == id));
 }
示例#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);
 }
示例#5
0
 public Task <bool> Exists(Guid id)
 {
     return(_context.Set <Album>().AnyAsync(x => x.Id == id));
 }
示例#6
0
 public Subscription Create(Subscription subscription)
 {
     return(_context.Set <Subscription>().Add(subscription).Entity);
 }