示例#1
0
        public async Task <ActionResult> IndexByProvince()
        {
            string iso = RouteData.Values["id"].ToString();

            JsonRegions dataRegions = await CovidAPI.getRegion();

            JsonReports dataReports = await CovidAPI.getReportsByProvince(iso);

            List <ReportsModels> dataReportsShown = new List <ReportsModels>();

            dataReportsShown = dataReports.data;
            dataReportsShown = dataReportsShown.OrderByDescending(x => Convert.ToInt32(x.confirmed)).ToList <ReportsModels>();

            //dataReportsShown = from x in dataReports.data
            //                   orderby x.active descending
            //                   select x;

            ViewBag.regions = dataRegions.data.OrderBy(x => x.name).ToList <RegionsModels>();
            ViewBag.reports = dataReportsShown.Take(10);
            ViewBag.iso     = iso;
            return(View());
        }
示例#2
0
        // GET: CovidAPI
        public async Task <ActionResult> Index()
        {
            //ViewBag.data = getReportsByRegion();
            //ViewBag.provinces = getReportsByProvince();

            JsonRegions dataRegions = await CovidAPI.getRegion();

            JsonReports dataReports = await CovidAPI.getReports();

            List <ReportsModels> dataReportsShown = new List <ReportsModels>();

            dataReportsShown = dataReports.data;
            dataReportsShown = dataReportsShown.OrderByDescending(x => Convert.ToInt32(x.confirmed)).ToList <ReportsModels>();

            //dataReportsShown = from x in dataReports.data
            //                   orderby x.active descending
            //                   select x;

            ViewBag.regions = dataRegions.data.OrderBy(x => x.name).ToList <RegionsModels>();
            ViewBag.reports = dataReportsShown.Take(10);
            return(View());
        }
示例#3
0
        public SubPage()
        {
            InitializeComponent();

            CAPI = new CovidAPI();

            // Color line.
            BoxView BoxLine = new BoxView
            {
                Color             = Color.DarkGreen,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            // Welcome message
            Label message = new Label
            {
                Text              = "Welcome to Covid-19 Data!  Please put country name below!",
                TextColor         = Color.Blue,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                FontSize          = 29
            };

            // Color line.
            BoxView BoxLine2 = new BoxView
            {
                Color             = Color.DarkGreen,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            // When country entry changed, set blank to all labels.
            country.TextChanged += Country_TextChanged;

            // Data button as btnData
            Button btnData = new Button
            {
                Text      = "Response from Data Base",
                FontSize  = 25,
                TextColor = Color.DarkCyan
            };

            btnData.Clicked += BtnData_Clicked;

            // Deaths button as btnDeaths
            Button btnDeaths = new Button
            {
                Text      = "Deaths",
                FontSize  = 25,
                TextColor = Color.Red
            };

            btnDeaths.Clicked += BtnDeaths_Clicked;

            // Recovered button as btnRecovered
            Button btnRecovered = new Button
            {
                Text      = "Recovered",
                FontSize  = 25,
                TextColor = Color.Blue
            };

            btnRecovered.Clicked += BtnRecovered_Clicked;

            // Confirmed button as btnConfirmed
            Button btnConfirmed = new Button
            {
                Text      = "Confirmed",
                FontSize  = 25,
                TextColor = Color.Green
            };

            btnConfirmed.Clicked += BtnConfirmed_Clicked;

            // Exit button as btnExit
            Button btnExit = new Button
            {
                Text      = "Exit",
                FontSize  = 25,
                TextColor = Color.Black
            };

            btnExit.Clicked += BtnExit_Clicked;

            // Layout setting
            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Children          =
                {
                    BoxLine,
                    message,
                    country,
                    btnData,
                    data,
                    new StackLayout
                    {
                        HorizontalOptions = LayoutOptions.Center,
                        Children          =
                        {
                            btnDeaths,
                            deaths,
                            btnRecovered,
                            recovered,
                            btnConfirmed,
                            confirmed,
                            btnExit,
                        }
                    },
                    BoxLine2,
                }
            };
            //ScrollView scrollView = new ScrollView();
            //Content = scrollView;
        }
        public MainPage()
        {
            InitializeComponent();

            CAPI = new CovidAPI();

            // Color line.
            BoxView BoxLine = new BoxView
            {
                Color             = Color.DarkGreen,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            // Welcome message
            Label message = new Label
            {
                Text              = "Welcome to Covid-19 Data!",
                TextColor         = Color.Blue,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                FontSize          = 29
            };

            // Color line.
            BoxView BoxLine2 = new BoxView
            {
                Color             = Color.DarkGreen,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            // CountryList button as btnCList
            Button btnCList = new Button
            {
                Text      = "Country List",
                FontSize  = 25,
                TextColor = Color.DarkCyan
            };

            btnCList.Clicked += BtnCList_Clicked;

            // Map button as btnMap
            Button btnMap = new Button
            {
                Text      = "Map",
                FontSize  = 25,
                TextColor = Color.Blue
            };

            btnMap.Clicked += BtnMap_Clicked;

            // Exit button as btnExit
            Button btnExit = new Button
            {
                Text      = "Exit",
                FontSize  = 25,
                TextColor = Color.Black
            };

            btnExit.Clicked += BtnExit_Clicked;

            // SubPage button as btnSub
            //Button btnSub = new Button
            //{
            //    Text = "Sub Page",
            //    FontSize = 25,
            //    TextColor = Color.Red
            //};
            //btnSub.Clicked += BtnSub_Clicked;

            // Layout setting
            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Children          =
                {
                    BoxLine,
                    message,
                    BoxLine2,
                    btnCList,
                    btnMap,
                    btnExit,
                    //btnSub,
                }
            };
        }