// GET: public IActionResult AddSpot() { ViewBag.Title = "Add A New Spot"; AddSpotViewModel addSpotViewModel = new AddSpotViewModel(); return(View(addSpotViewModel)); }
public IActionResult AddSpot(AddSpotViewModel addSpotViewModel) { ViewBag.Title = "Add A New Spot"; if (ModelState.IsValid) { // Add New Location to the database Marker newMarker = new Marker { Name = addSpotViewModel.Name, Address = addSpotViewModel.Address, Lat = addSpotViewModel.Lat, Lng = addSpotViewModel.Lng, Url = addSpotViewModel.Url, Password = addSpotViewModel.Password }; context.Markers.Add(newMarker); context.SaveChanges(); return(Redirect("/Home")); } return(View(addSpotViewModel)); }