public ActionResult Edit(Guid id)
        {
            ViewBag.Title = Resources.Edit_ProfileGroup;

            var group = _profileGroupRepository.GetById(id);

            if (group == null)
            {
                return(RedirectToAction("Index"));
            }
            var model = Mapper.Map <ProfileGroupViewModel>(group);

            PopulateViewModel(model);
            return(View("CreateEdit", model));
        }
Beispiel #2
0
        private Location GetLocation(LocationViewModel model)
        {
            var location = new Location
            {
                Id                  = model.Id,
                Comment             = model.Comment,
                Name                = model.Name,
                ShortName           = model.ShortName,
                Net                 = model.Net,
                Cidr                = model.Cidr,
                Net_v6              = model.NetV6,
                Cidr_v6             = model.CidrV6,
                CarrierConnectionId = model.CarrierConnectionId,
                UpdatedBy           = User.Identity.Name
            };

            if (model.Region != Guid.Empty)
            {
                var region = _regionRepository.GetById(model.Region);

                if (region != null)
                {
                    location.Region = region;
                }
            }

            if (model.City != Guid.Empty)
            {
                var city = _cityRepository.GetById(model.City);
                if (city != null)
                {
                    location.City = city;
                }
            }

            var profileGroup = _profileGroupRepository.GetById(model.ProfileGroup ?? Guid.Empty);

            location.ProfileGroup = profileGroup;

            return(location);
        }
 public ProfileGroup GetById(Guid id)
 {
     return(_internalRepository.GetById(id));
 }