public ActionResult Edit(Location location) { if (ModelState.IsValid) { // compute Woeid & GMT offset location.Woeid = GetDefaultWoeid(location.Latitude, location.Longitude); if (location.TimeZone == null) location.TimeZone = TimeZoneInfo.Local.Id; // GetDefaultTimeZone(location.Latitude, location.Longitude); db.Entry(location).State = EntityState.Modified; db.Entry(location).Property(l => l.LevelId).IsModified = false; db.Entry(location).Property(l => l.AreaId).IsModified = false; db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index"); } //FillLevelsSelectList(location.LevelId); FillTemperatureUnitSelectList(location.TemperatureUnit); //FillAreaSelectList(location.LocationId, location.AreaId); FillCulturesSelectList(location.Culture); this.FillSystemTimeZoneSelectList(location.TimeZone); return View(location); }
public ActionResult Create(Location location) { if (ModelState.IsValid) { // compute Woeid & GMT offset location.Woeid = GetDefaultWoeid(location.Latitude, location.Longitude); if (location.TimeZone == null) location.TimeZone = TimeZoneInfo.Local.Id; // GetDefaultTimeZone(location.Latitude, location.Longitude); db.Locations.Add(location); db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index"); } FillLevelsSelectList(location.LevelId); FillTemperatureUnitSelectList(location.TemperatureUnit); FillAreaSelectList(location.LocationId, location.AreaId); FillCulturesSelectList(location.Culture); this.FillSystemTimeZoneSelectList(location.TimeZone); return View(location); }