Ejemplo n.º 1
0
        //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);
        }
Ejemplo n.º 2
0
 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");
 }
Ejemplo n.º 3
0
 //Partial (modal) to create new location
 public ActionResult Create()
 {
     Location location = new Location();
     return PartialView(location);
 }