예제 #1
0
        public ActionResult EditLocation(int id)
        {
            ILocationRepo locorepo = LocationRepoFactory.Create();
            var           location = locorepo.GetLocationById(id);
            var           model    = new LocationVM
            {
                LocationID          = location.LocationID,
                LocationName        = location.LocationName,
                LocationAddress     = location.LocationAddress,
                LocationDescription = location.LocationDescription,
                LatitudeCoordinate  = location.LatitudeCoordinate,
                LongitudeCoordinate = location.LongitudeCoordinate,
            };

            locorepo.EditLocation(location);
            return(View(model));
        }
예제 #2
0
        public ActionResult EditLocation(LocationVM l)
        {
            ILocationRepo locorepo = LocationRepoFactory.Create();

            if (ModelState.IsValid)
            {
                var location = new Location
                {
                    LocationID          = l.LocationID,
                    LocationName        = l.LocationName,
                    LocationAddress     = l.LocationAddress,
                    LocationDescription = l.LocationDescription,
                    LatitudeCoordinate  = l.LatitudeCoordinate,
                    LongitudeCoordinate = l.LongitudeCoordinate,
                };
                locorepo.EditLocation(location);
            }
            return(RedirectToAction("LocationList"));
        }