public RedirectToRouteResult Delete(Location location, string returnUrl) { Location loc = _efDbContext.Locations.FirstOrDefault(l => l.LocationID == location.LocationID); if (loc != null) { _efDbContext.Locations.Remove(loc); } _efDbContext.SaveChanges(); return RedirectToAction("Index", new { returnUrl }); }
public ActionResult Update(Location location, string returnUrl) { Location loc = _efDbContext.Locations.FirstOrDefault(l => l.LocationID == location.LocationID); if (loc != null) { loc.LocationCity = location.LocationCity; loc.LocationZip = location.LocationZip; loc.LocationState = location.LocationState; loc.LocationCountry = location.LocationCountry; loc.LocationRadius = location.LocationRadius; } _efDbContext.SaveChanges(); return RedirectToAction("Index", new { returnUrl }); }
public ActionResult Create(Location location, string returnUrl) { Location loc = new Location { LocationCity = location.LocationCity, LocationCountry = location.LocationCountry, LocationState = location.LocationState, LocationZip = location.LocationZip, LocationRadius = location.LocationRadius }; _efDbContext.Locations.Add(loc); _efDbContext.SaveChanges(); return RedirectToAction("Index", new { returnUrl }); }