Esempio n. 1
0
 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 });
 }
Esempio n. 2
0
        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 });
        }
Esempio n. 3
0
        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 });
        }