Example #1
0
        public ActionResult <IEnumerable <DailyCovidResult> > GetCases([FromQuery] QueryModel queryModel)
        {
            var entityCases = _context.DailyCovidOverviews
                              .Where(dailyData => (queryModel.From == null || dailyData.Date >= queryModel.From) &&
                                     (queryModel.To == null || dailyData.Date <= queryModel.To) &&
                                     (queryModel.MinConfirmed == null || dailyData.DailyNewConfirmed >= queryModel.MinConfirmed) &&
                                     (queryModel.MaxConfirmed == null || dailyData.DailyNewConfirmed <= queryModel.MaxConfirmed))
                              .OrderBy(dailyData => dailyData.Date);


            return(DailyCovidDataMapper.Map(entityCases));
        }
Example #2
0
        public ActionResult <IEnumerable <DailyCovidResult> > GetAll()
        {
            var entityCases = _context.DailyCovidOverviews.OrderByDescending(dailyData => dailyData.Date);

            return(DailyCovidDataMapper.Map(entityCases));
        }
Example #3
0
        public ActionResult <DailyCovidResult> GetLatest()
        {
            var entityCase = _context.DailyCovidOverviews.OrderByDescending(dailyData => dailyData.Date).FirstOrDefault();

            return(DailyCovidDataMapper.Map(entityCase));
        }