Beispiel #1
0
        public async Task <List <CarModel> > GetCarsByModel(string model)
        {
            var cars        = new List <CarModel>();
            var carsByModel = CarCollection.Find(car => car.Model == model);
            await carsByModel.ForEachAsync(doc => cars.Add(doc));

            return(cars);
        }
Beispiel #2
0
        public async Task <List <CarModel> > GetCars()
        {
            var cars = new List <CarModel>();

            var allDocuments = CarCollection.Find(new BsonDocument());
            await allDocuments.ForEachAsync(doc => cars.Add(doc));

            return(cars);
        }