示例#1
0
        public async Task <ActionResult <StreetLevelCrimesModel[]> > GetStreetCrimeByLocationAndDate(string date)
        {
            // PLACEHOLDER DATE needs to be YYYY-MM, '2019-01' works in Postman
            var streetLevelResultsByDate = await _crimesRepo.GetAllStreetLevelCrimesByLocationAndTime(date, null, null, null);

            if (streetLevelResultsByDate != null)
            {
                return(Ok(streetLevelResultsByDate));
            }

            return(NotFound());
        }
        public async Task <IActionResult> Index(SelectStreetCrimeDateViewModel model)
        {
            var streetLevelResultsByDate = await _crimesRepo.GetAllStreetLevelCrimesByLocationAndTime(model.Month, model.Year, model.PostcodePartOne, model.PostcodePartTwo);

            streetLevelResultsByDate.AllCategories = await _crimesRepo.GetAllCategories();

            if (streetLevelResultsByDate != null)
            {
                return(View(streetLevelResultsByDate));
            }

            return(NotFound());
        }