public void Start() { using (var ctx = _database.Context()) _cities = ctx.CityWeathers.ToList(); _task = new Task(async() => { while (true) { foreach (var city in _cities) { _message.Publish(new WeatherRequest { City = city.Name }); } await Task.Delay(_waitTime); } }); _task.Start(); }
public Response GetAllCities() { using (var ctx = _database.Context()) return(RawJSON($"[{string.Join(", ", ctx.CityWeathers.ToList().Select(d => d.JSON))}]")); }