public async Task <List <Speciality> > GetSpecialitiesAll() { List <Speciality> results = null; var filter = new BsonDocument("Code", new BsonDocument("$ne", "")); results = await Specialities.Find <Speciality>(filter).ToListAsync(); if (results != null) { return(results); } else { return(null); } }
/*public async Task<User> GetUsersAsync(string email, string pass) * { * * List<User> results = null; * var filter = new BsonDocument("$and", new BsonArray{ * * new BsonDocument("Email",new BsonDocument("$eq", email)), * new BsonDocument("Password", pass) * }); * results = await Users.Find<User>(filter).ToListAsync(); * if (results != null) * return results.FirstOrDefault(); * else return null; * }*/ // получаем один документ по id /*public async Task<User> GetUser(string id) * { * return await Users.Find(new BsonDocument("_id", new ObjectId(id))).FirstOrDefaultAsync(); * }*/ public async Task <Speciality> GetSpecialityCode(string code) { List <Speciality> results = null; var filter = new BsonDocument("Code", new BsonDocument("$eq", code)); results = await Specialities.Find <Speciality>(filter).ToListAsync(); if (results != null) { return(results.FirstOrDefault()); } else { return(null); } }