public RegionalWeatherModel GetWeather() { try { var sort = Builders <RegionalWeatherModel> .Sort.Descending("_id"); model = new DBManger().DataBase.GetCollection <RegionalWeatherModel>(CollectionName).Find <RegionalWeatherModel>(schedule => true).Sort(sort).FirstOrDefault(); } catch (Exception ex) { Debug.WriteLine("Weather controller get data error: " + ex); return(null); } return(model); }
public void Remove(RegionalWeatherModel weatherIn) => _weather.DeleteOne(weather => weather.Id == weatherIn.Id);
public void Update(string id, RegionalWeatherModel weatherIn) => _weather.ReplaceOne(weather => weather.Id == id, weatherIn);
public RegionalWeatherModel Create(RegionalWeatherModel weather) { _weather.InsertOne(weather); return(weather); }