Пример #1
0
        //
        // GET: /ServiceLocations/Edit/5
        public ActionResult Edit(int id)
        {
            ServiceLocationBAL _serviceLocationBAL = new ServiceLocationBAL();
            ServiceLocation    _serviceLocation    = _serviceLocationBAL.GetServiceLocationById(id);
            var model = new ServiceLocationModel();

            model.Id        = _serviceLocation.Id;
            model.Location  = _serviceLocation.Location;
            model.City      = _serviceLocation.City;
            model.State     = _serviceLocation.State;
            model.Country   = _serviceLocation.Country;
            model.Zipcode   = _serviceLocation.Zipcode;
            model.IpAddress = _serviceLocation.IpAddress;
            _serviceLocationBAL.UpdateServiceLocation(_serviceLocation);

            return(View(model));
        }
Пример #2
0
        public ActionResult Edit(int id, ServiceLocationModel serviceLocation)
        {
            try
            {
                // TODO: Add update logic here
                ServiceLocationBAL serviceLocationBAL = new ServiceLocationBAL();
                ServiceLocation    _serviceLocation   = serviceLocationBAL.GetServiceLocationById(id);
                _serviceLocation.Id        = serviceLocation.Id;
                _serviceLocation.Location  = serviceLocation.Location;
                _serviceLocation.City      = serviceLocation.City;
                _serviceLocation.State     = serviceLocation.State;
                _serviceLocation.Country   = serviceLocation.Country;
                _serviceLocation.Zipcode   = serviceLocation.Zipcode;
                _serviceLocation.IpAddress = serviceLocation.IpAddress;
                serviceLocationBAL.UpdateServiceLocation(_serviceLocation);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }