public async Task <Cities> GetAsync(int id, int dayCount) { //.Where(i => i.MeasureDate >= DateTime.UtcNow && i.MeasureDate < DateTime.UtcNow.AddDays(dayCount)) //return await _dbContext.Cities.Include(x => x.WeatherMeasures.Where(i => i != null)) // .FirstOrDefaultAsync(i => i.CityId == id); Cities city = await _dbContext.Cities.FirstOrDefaultAsync(i => i.CityId == id); _dbContext.Entry(city) .Collection(i => i.WeatherMeasures) .Query() .Where(i => i.MeasureDate >= DateTime.UtcNow.AddDays(-1) && i.MeasureDate < DateTime.UtcNow.AddDays(dayCount - 1)) .Load(); return(city); }
public ActionResult Edit([Bind(Include = "ID,ZIPCODE,LOCATION,FORECAST,TEMPERATURE")] Weather weather) { if (ModelState.IsValid) { db.Entry(weather).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(weather)); }
public ActionResult Edit([Bind(Include = "Id,Location,Day,Hour,Velocity")] WindSpeed windSpeed) { if (ModelState.IsValid) { db.Entry(windSpeed).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(windSpeed)); }
public ActionResult Edit([Bind(Include = "Id,Location,Day,SkyCondition,CurrentTemp,DewPoint")] FogCalculation fogCalculation) { if (ModelState.IsValid) { db.Entry(fogCalculation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fogCalculation)); }
public ActionResult Edit([Bind(Include = "Id,Location,Day,Hour,DegreeTemperature,DewPoint")] Temperature temperature) { if (ModelState.IsValid) { db.Entry(temperature).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(temperature)); }
public ActionResult Edit([Bind(Include = "Id,Location,Day,ChillSpeed,Degree_Id")] Humidity humidity) { if (ModelState.IsValid) { db.Entry(humidity).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Degree_Id = new SelectList(db.Temperatures, "Id", "Location", humidity.Degree_Id); return(View(humidity)); }