public List <Models.Song> GetSongs(int id) { List <Models.Song> songs = new List <Models.Song>(); var couples = _dbContext.ListSong.Where(x => x.PlaylistId == id); foreach (ListSong ls in couples) { var song = _dbContext.Song.Where(x => x.Id == ls.SongId).FirstOrDefault(); songs.Add(SongMapper.FromDatabase(song)); } return(songs); }
public async Task <Models.Song> GetAsync(int id) { var result = await _dbContext.Song.SingleOrDefaultAsync(x => x.Id == id); return(SongMapper.FromDatabase(result)); }
public IEnumerable <Models.Song> GetAll() { return(_dbContext.Song.Select(x => SongMapper.FromDatabase(x))); }