public ActionResult PlaceInput([Bind(Include = "Place")] ViewModel model) { /* * Put in a try catch here, and then send * */ if (ModelState.IsValid) { var place = model.place; var time = DateTime.Now; var placeService = new PlaceServiceTest(); string region = placeService.GetRegion(place); NewWeather weatherIno = placeService.GetWeatherinfo(place, region); var latitude = 51.508742; Weather weather = new Weather { longitude = 12, latitude = 123, place = "stockholm" }; TempData["weatherObject"] = weatherIno; TempData["latitude"] = weatherIno.latitude; TempData["longitude"] = weatherIno.longitude; return(RedirectToAction("GetMap")); } return(View()); }
// // GET: /NewWeather/Edit/5 public ActionResult Edit(int id) { NewWeather newweather = db.NewWeathers.Single(n => n.ID == id); ViewBag.owner = new SelectList(db.NewUsers, "ID", "name", newweather.owner); return(View(newweather)); }
public ActionResult DeleteConfirmed(int id) { NewWeather newweather = db.NewWeathers.Single(n => n.ID == id); db.NewWeathers.DeleteObject(newweather); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(NewWeather newweather) { if (ModelState.IsValid) { db.NewWeathers.Attach(newweather); db.ObjectStateManager.ChangeObjectState(newweather, EntityState.Modified); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.owner = new SelectList(db.NewUsers, "ID", "name", newweather.owner); return(View(newweather)); }
public ActionResult Create(NewWeather newweather) { if (ModelState.IsValid) { db.NewWeathers.AddObject(newweather); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.owner = new SelectList(db.NewUsers, "ID", "name", newweather.owner); return(View(newweather)); }
public IEnumerable <WeatherForecast> NewWeatherForecast([FromBody] NewWeather newWeather) { //will always return freezing, whatever.... var oldWeather = Get(); var weatherForecast = new WeatherForecast() { Date = DateTime.Now, TemperatureC = int.Parse(newWeather.Temperature), Summary = Summaries[0] }; oldWeather.Append(weatherForecast); return(oldWeather); }
// // GET: /NewWeather/Delete/5 public ActionResult Delete(int id) { NewWeather newweather = db.NewWeathers.Single(n => n.ID == id); return(View(newweather)); }
// // GET: /NewWeather/Details/5 public ViewResult Details(int id) { NewWeather newweather = db.NewWeathers.Single(n => n.ID == id); return(View(newweather)); }
public ActionResult AjaxGetObjectInfo(string placename) { NewWeather newweather = db.NewWeathers.Single(n => n.place == "placename"); return(Json(newweather)); }