public ActionResult Change(DTO.WeatherData data) { if (ModelState.IsValid) { accessdata.PutWeaterData(data); } //for future referecne save in viewbag ViewBag.idlocation = data.LocationID; return(RedirectToAction("WeatherData", "Weatherdata", new { id = ViewBag.idlocation })); }
public ActionResult Change(int id, int idlocation) { //for future referecne save in viewbag ViewBag.idlocation = idlocation; //make dropdownlist List <SelectListItem> items = new List <SelectListItem>(); items.Add(new SelectListItem { Text = "bluesky", Value = "0" }); items.Add(new SelectListItem { Text = "littlecloudy", Value = "1" }); items.Add(new SelectListItem { Text = "fewrainy", Value = "2", Selected = true }); items.Add(new SelectListItem { Text = "littlestormy", Value = "3" }); ViewBag.myDropdownlistItems = items; /* * if (name.Equals("bluesky")) * { * path = "~/Content/150x150/sunny.png"; * } * if (name.Equals("littlecloudy")) * { * path = "~/Content/150x150/m-cloudy.png"; * } * if (name.Equals("fewrainy")) * { * path = "~/Content/150x150/m-c-rain.png"; * } * if (name.Equals("littlestormy")) * { * path = "~/Content/150x150/chance-storm.png"; * } * if (name.Equals("littleSnow")) * { * path = "~/Content/150x150/m-c-snow.png"; * } * if (name.Equals("cloudy")) * { * path = "~/Content/150x150/cloudy.png"; * } * if (name.Equals("Rainy")) * { * path = "~/Content/150x150/rainy.png"; * } * if (name.Equals("Stormy")) * { * path = "~/Content/150x150/thunder-storm.png"; * } * if (name.Equals("Snow")) * { * path = "~/Content/150x150/snow.png"; * * */ DTO.WeatherData changedata = null; fullist = accessdata.RandomLoc(idlocation); for (int i = 0; i < fullist.Count; i++) { foreach (DTO.WeatherData data in fullist[i]) { if (data.Id == id) { changedata = data; } } } return(View(changedata)); }