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)); }
public Task <User> GetById(Guid id) { return(_context.Set <User>() .Include(x => x.Subscriptions) .FirstOrDefaultAsync(x => x.Id == id)); }
public Band CreateBand(Band band) { return(_context.Set <Band>().Add(band).Entity); }
public Playlist Create(Playlist playlist) { return(_context.Set <Playlist>().Add(playlist).Entity); }
public Task <bool> Exists(Guid id) { return(_context.Set <Album>().AnyAsync(x => x.Id == id)); }
public Subscription Create(Subscription subscription) { return(_context.Set <Subscription>().Add(subscription).Entity); }