예제 #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);
        }
예제 #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");
 }
예제 #3
0
 //Partial (modal) to create new location
 public ActionResult Create()
 {
     Location location = new Location();
     return PartialView(location);
 }