Пример #1
0
        async Task <EnvironmentItemViewModel[]> LoadEnvironmentData()
        {
            var data = (await new ItalyEnvironmentSource(_env.WebRootPath + "\\data\\air_quality.csv").LoadAsync()).Select(a =>
            {
                var item = new EnvironmentItemViewModel()
                {
                    Value    = a,
                    Position = Geo.Project(a.Location),
                    Radius   = 100
                };
                if (a.Value < 20)
                {
                    item.Severity = PollutantSeverity.Good;
                }
                else if (a.Value < 40)
                {
                    item.Severity = PollutantSeverity.Medium;
                }
                else if (a.Value < 50)
                {
                    item.Severity = PollutantSeverity.Bad;
                }
                else if (a.Value < 75)
                {
                    item.Severity = PollutantSeverity.Sever;
                }
                else
                {
                    item.Severity = PollutantSeverity.VerySevere;
                }

                return(item);
            }).ToArray();

            return(data);
        }