// GET: BaseLayers/Create
        public ActionResult ChangeAttach(long id)
        {
            var regionsRepository = new RegionsRepository();
            var pagesRepository = new PagesRepository();

            var region = regionsRepository.GetById(id);

            IDisposable context = null;

            ViewBag.ListOfPages = pagesRepository.GetAll(out context).ToList().Select(x => new SelectListItem()
            {
                Value = x.Id.ToString(),
                Text = x.Name,
                Selected = region != null && region.PageId == x.Id
            });

            context?.Dispose();

            var model = new ChangeAttachPageViewModel()
            {
                Id = id,
                OldPageId = region?.PageId
            };

            return PartialView(model);
        }
        public ActionResult Index()
        {
            var pagesRepository = new PagesRepository();

            IDisposable context;
            var points = pagesRepository.GetAll(out context).ToList().Select(x => new PageViewModel(x)).ToList();

            using (context)
            {
                return View(points);
            }
        }
        public IEnumerable<PageApiViewModel> GetAllPages()
        {
            IDisposable context;

            var pagesRepository = new PagesRepository();
            var pages = pagesRepository.GetAll(out context).ToList();

            var result = pages.Select(page => new PageApiViewModel(page));

            context.Dispose();

            return result;
        }