/// <summary>
        /// Gets a region.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public RegionViewModel GetRegion(int id)
        {
            RegionList regions = CoreData.RegionManager.GetRegionsByIds(UserContext, new List <int> {
                id
            });

            return(RegionViewModel.CreateFromRegion(regions[0]));
        }
Пример #2
0
        /// <summary>
        /// Creates a RegionViewModel list for a specific categoryId
        /// </summary>
        /// <param name="dicRegions">The dic regions.</param>
        /// <param name="categoryId">The category id.</param>
        /// <returns></returns>
        private List <RegionViewModel> CreateRegionList(Dictionary <int, List <IRegion> > dicRegions, int categoryId)
        {
            var list = new List <RegionViewModel>();

            foreach (IRegion region in dicRegions[categoryId])
            {
                list.Add(RegionViewModel.CreateFromRegion(region));
            }
            return(list);
        }
        /// <summary>
        /// Gets all spatial filter regions.
        /// </summary>
        /// <returns></returns>
        public List <RegionViewModel> GetAllRegions()
        {
            List <int> regionIds = MySettings.Filter.Spatial.RegionIds.ToList();

            if (regionIds.Count == 0)
            {
                return(new List <RegionViewModel>());
            }
            RegionList regions = CoreData.RegionManager.GetRegionsByIds(UserContext, regionIds);

            return((from IRegion region in regions select RegionViewModel.CreateFromRegion(region)).ToList());
        }