public async Task <ObservableCollection <Track> > ShowTrackDataAsync() { byte KeyValue = 0; byte ValidCondition = 0; do { string BarrelKeyValue; BarrelKeyValue = KeyValue.ToString(); var trackBarrelResult = Barrel.Current.Get <Track>(key: BarrelKeyValue); if (trackBarrelResult != null) { GetTracks.Add(trackBarrelResult); } else { ValidCondition++; } KeyValue++; } while (ValidCondition != 1); return(GetTracks); }
public object GetJson(GetTracks request) { using (var db = dbFactory.Open()) { // TODO: Also do a join on the album's categoryId to make sure all Ids match. var tracks = db.Select <Track>().Where(t => t.AlbumId == request.AlbumId); if (tracks.Any()) { return(new TracksResponse { Status = "success", Data = tracks }); } else { throw HttpError.NotFound("Tracks not found."); } } }