Exemple #1
0
        // GET: AdminRegionCountry
        public ActionResult Region()
        {
            var regions = _regionRepository.GetAll()
                          .Select(t => new RegionViewModel
            {
                RegionID   = t.RegionID,
                RegionName = t.RegionName
            }).ToList();

            return(View(regions));
        }
Exemple #2
0
        public ActionResult Create()
        {
            var model = new WineViewModel();

            model.TypesList      = _typesRepository.GetTypes();
            model.SubTypesList   = _subTypeRepository.GetAll();
            model.BottleSizeList = _bottleSizeRepository.GetAll();
            model.RegionList     = _regionRepository.GetAll();
            model.CountryList    = db.Countries.ToList();

            return(View(model));
        }
        static void Main(string[] args)
        {
            try
            {
                //Create a Geode Cache using CacheFactory. By default it will connect to "localhost" at port 40404".
                Cache cache = CacheFactory.CreateCacheFactory().Create();

                Console.WriteLine("Created the Geode Cache");

                //Set Attributes for the region.
                RegionFactory regionFactory = cache.CreateRegionFactory(RegionShortcut.CACHING_PROXY);

                //Create exampleRegion
                IRegion <int, string> region = regionFactory.Create <int, string>("exampleRegion");

                Console.WriteLine("Created exampleRegion");

                // PutAll Entries (Key and Value pairs) into the Region.
                Dictionary <int, string> entryMap = new Dictionary <int, string>();
                for (Int32 item = 0; item < 100; item++)
                {
                    int    key   = item;
                    string value = item.ToString();
                    entryMap.Add(key, value);
                }
                region.PutAll(entryMap);
                Console.WriteLine("PutAll 100 entries into the Region");

                //GetAll Entries back out of the Region
                List <int> keys = new List <int>();
                for (int item = 0; item < 100; item++)
                {
                    int key = item;
                    keys.Add(key);
                }
                Dictionary <int, string> values = new Dictionary <int, string>();
                region.GetAll(keys.ToArray(), values, null, true);

                Console.WriteLine("Obtained 100 entries from the Region");

                // Close the Geode Cache.
                cache.Close();

                Console.WriteLine("Closed the Geode Cache");
            }
            // An exception should not occur
            catch (GeodeException gfex)
            {
                Console.WriteLine("PutAllGetAllOperations Geode Exception: {0}", gfex.Message);
            }
        }