//Partial (modal) to create or update location public ActionResult CreateUpdate(int id = 0) { Location a = db.Locations.Find(id); Location location = db.Locations.Find(id); //Location not found, create new location if (location == null) location = new Location(); return PartialView("CreateUpdate", location); }
public ActionResult CreatePost(Location loc) { if (ModelState.IsValid) { Location location = new Location(); location.Name = loc.Name; location.Latitude = loc.Latitude; location.Longitude = loc.Longitude; db.Locations.Add(location); db.SaveChanges(); } return RedirectToAction("List"); }
//Partial (modal) to create new location public ActionResult Create() { Location location = new Location(); return PartialView(location); }