Esempio n. 1
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "history")] HttpRequest req,
            ILogger log)
        {
            var history = HistoryDataStore.GetStore();

            return(new OkObjectResult(history));
        }
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "history/{initials}")] HttpRequest req,
            string initials,
            ILogger log)
        {
            if (string.IsNullOrWhiteSpace(initials))
            {
                return(new BadRequestResult());
            }
            var history = HistoryDataStore.GetStore().Where(h => h.Initials.Equals(initials, StringComparison.InvariantCultureIgnoreCase));

            return(new OkObjectResult(history));
        }
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "history/year/{year}")] HttpRequest req,
            int year,
            ILogger log)
        {
            if (year < 1990 || year > DateTime.Now.Year)
            {
                return(new BadRequestResult());
            }

            var history = HistoryDataStore.GetStore().Where(h => h.Year == year);

            return(new OkObjectResult(history));
        }