public async Task <IActionResult> PointsMap()
        {
            var username = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.Name).Value;

            ViewData["UserName"] = username;

            var city   = "北京";
            var specie = "侧柏";

            var citySpecies = await GetSpeciesAsync(city);//传输单一城市的植物清单

            IEnumerable <IGrouping <string, allpoint> > plantl = citySpecies.GroupBy(u => u.物名);
            List <SpieciesResult> species = new List <SpieciesResult>();

            foreach (IGrouping <string, allpoint> item in plantl)
            {
                List <allpoint> plantlist   = item.ToList();
                SpieciesResult  speciesname = new SpieciesResult();
                speciesname.species = plantlist[0].物名;
                species.Add(speciesname);
            }
            ViewBag.citySpecies = Newtonsoft.Json.JsonConvert.SerializeObject(species);

            var onlyOnePlant = await GetDatasAsync(city, specie);//传输“单一城市单一植物”数据

            List <plantResult> plantsData = new List <plantResult>();

            foreach (var item in onlyOnePlant)
            {
                plantResult plant = new plantResult();
                plant.datax1  = convertDate(item.叶芽开始膨大期);
                plant.datax2  = convertDate(item.叶芽开放期);
                plant.datax3  = convertDate(item.花芽开始膨大期);
                plant.datax4  = convertDate(item.花芽开放期);
                plant.datax5  = convertDate(item.开始展叶期);
                plant.datax6  = convertDate(item.展叶盛期);
                plant.datax7  = convertDate(item.花序或花蕾出现期);
                plant.datax8  = convertDate(item.开花始期);
                plant.datax9  = convertDate(item.开花盛期);
                plant.datax10 = convertDate(item.开花末期);
                plant.datax11 = convertDate(item.第二次开花期);
                plant.datax12 = convertDate(item.果实成熟期);
                plant.datax13 = convertDate(item.果实脱落开始期);
                plant.datax14 = convertDate(item.果实脱落末期);
                plant.datax15 = convertDate(item.叶开始变色期);
                plant.datax16 = convertDate(item.叶全部变色期);
                plant.datax17 = convertDate(item.开始落叶期);
                plant.datax18 = convertDate(item.落叶末期);
                plant.datay   = item.年份 + '年';
                plant.zhuji   = item.注记;
                plantsData.Add(plant);
            }
            ViewBag.onlyPlant = Newtonsoft.Json.JsonConvert.SerializeObject(plantsData);
            return(View());
        }
        public string GetSpeciesListAsync([FromBody] CityResult res)//获取单一城市植物物种
        {
            List <allpoint> citySpecies = new List <allpoint>();

            citySpecies = _context.allpoint.Where(a => a.站点 == res.city).ToList();
            IEnumerable <IGrouping <string, allpoint> > plant = citySpecies.GroupBy(u => u.物名);
            List <SpieciesResult> species = new List <SpieciesResult>();

            foreach (IGrouping <string, allpoint> item in plant)
            {
                List <allpoint> plantlist   = item.ToList();
                SpieciesResult  speciesname = new SpieciesResult();
                speciesname.species = plantlist[0].物名;
                species.Add(speciesname);
            }
            string citySpeciesList = Newtonsoft.Json.JsonConvert.SerializeObject(species);

            return(citySpeciesList);
        }
        public string GetYearListAsync([FromBody] SpieciesResult spi)
        {
            List <allpoint> citySpecies = new List <allpoint>();

            citySpecies = _context.allpoint.Where(a => a.物名 == spi.species).ToList();
            IEnumerable <IGrouping <string, allpoint> > plant = citySpecies.GroupBy(u => u.年份);
            List <CityResult> year = new List <CityResult>();

            foreach (IGrouping <string, allpoint> item in plant)
            {
                List <allpoint> plantlist = item.ToList();
                CityResult      yearname  = new CityResult();
                yearname.city = plantlist[0].年份;
                year.Add(yearname);
            }
            var    yearo        = year.OrderByDescending(u => u.city);
            string cityYearList = Newtonsoft.Json.JsonConvert.SerializeObject(yearo);

            return(cityYearList);
        }