コード例 #1
0
        public ActionResult Country(string country) // the parameter needed to use string interpolation in CountryUtil
        {
            RegionInfo        myRI = new RegionInfo(country);
            CountryUtil       cu   = new CountryUtil();
            IndividualSpecies ind  = new IndividualSpecies();
            var countryspecies     = cu.Country(country);
            //var endangeredSpecies = cu.Country(country).Where(c => c.Category == "EN");
            //var extinctSpecies = cu.Country(country).Where(c => c.Category == "EX");
            //var extinctWildSpecies = cu.Country(country).Where(c => c.Category == "EW");
            //var criticallyEndangeredSpecies = cu.Country(country).Where(c => c.Category == "CR");
            //var vulnerableSpecies = cu.Country(country).Where(c => c.Category == "VU");
            var allThreatenedSpecies = cu.Country(country).Where(c => c.Category == "EN" || c.Category == "EX" || c.Category == "EW" ||
                                                                 c.Category == "CR" || c.Category == "VU");

            ViewBag.C          = myRI.EnglishName; // Annukka is PROUD of this bit :)
            ViewBag.RI         = myRI;
            ViewBag.Categories = string.Join("", ind.Category);
            RestUtil ru = new RestUtil();

            //foreach (var item in allThreatenedSpecies)
            //{
            //    //string name = ru.SingleSpecies(item.ScientificName).FirstOrDefault()?.MainCommonName;
            //    string name = ru.SingleSpecies(item.ScientificName).FirstOrDefault()?.MainCommonName;
            //    item.CommonName = name;
            //}

            return(View(allThreatenedSpecies)); // check what we actually want here!!
            //return View(countryspecies);
        }
コード例 #2
0
        // GET IUCN for count of species in different vulnerability classes
        //searchTerm: vulnerability class
        public ActionResult SCategory(string searchTerms)
        {
            IndividualSpecies ind = new IndividualSpecies();

            ViewBag.SC = ind.Category;
            var _sc = _rs.SCategory(searchTerms);

            return(View(_sc));
        }
コード例 #3
0
        public ActionResult Country(string country)
        {
            RegionInfo        myRI   = new RegionInfo(country);
            CountryUtil       cu     = new CountryUtil();
            IndividualSpecies ind    = new IndividualSpecies();
            var countryspecies       = cu.Country(country);
            var allThreatenedSpecies = cu.Country(country).Where(c => c.Category == "EN" || c.Category == "EX" || c.Category == "EW" ||
                                                                 c.Category == "CR" || c.Category == "VU");

            ViewBag.C          = myRI.EnglishName;
            ViewBag.RI         = myRI;
            ViewBag.Categories = string.Join("", ind.Category);
            RestUtil ru = new RestUtil();

            //TODO: Upload common names to a json from which to query
            //foreach (var item in allThreatenedSpecies)
            //{
            //    //string name = ru.SingleSpecies(item.ScientificName).FirstOrDefault()?.MainCommonName;
            //    string name = ru.SingleSpecies(item.ScientificName).FirstOrDefault()?.MainCommonName;
            //    item.CommonName = name;
            //}

            return(View(allThreatenedSpecies)); // check what we actually want here!!
        }