示例#1
0
        public async Task <ActionResult <CountModel> > GetTotal([FromQuery] string province)
        {
            var result = await _casesService.GetCumulative();

            if (result == null)
            {
                return(Ok(new CountModel {
                    CasesTotal = Int32.MinValue, Date = DateTime.Now
                }));
            }

            if (!string.IsNullOrWhiteSpace(province))
            {
                return(Ok(new CountModel
                {
                    CasesTotal = CumulativeUtility.GetTotalForProvince(result, province),
                    Date = DateTime.Now
                }));
            }
            else
            {
                return(Ok(new CountModel
                {
                    CasesTotal = CumulativeUtility.GetTotal(result),
                    Date = result.Last().Date
                }));
            }
        }
示例#2
0
        public async Task <ActionResult <CountModel> > GetLatestUpdate()
        {
            var result = await _casesService.GetCumulative();

            if (result == null)
            {
                return(Ok(new CountModel()));
            }

            return(CumulativeUtility.GetLatest(result));
        }
示例#3
0
        public async Task <ActionResult <List <CountModel> > > GetAllPerDayAggregate([FromQuery] string province)
        {
            var result = await _casesService.GetCumulative();

            if (string.IsNullOrWhiteSpace(province))
            {
                return(Ok(CumulativeUtility.GetCumulative(result)));
            }
            else
            {
                return(Ok(CumulativeUtility.GetCumulativeForProvince(result, province)));
            }
        }