Ejemplo n.º 1
0
        public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "alarms/{watchId}")] HttpRequest req,
            ILogger log, string watchId)
        {
            try{
                List <AlarmWithSubscription> machinesWithSubs = _alarmService.GetAllAlarmsWithSubs(watchId);

                if (machinesWithSubs.Count == 0)
                {
                    return(new NoContentResult());
                }

                return(new OkObjectResult(machinesWithSubs));
            }catch (InvalidDataException e)
            {
                return(new BadRequestObjectResult(e.Message));
            }
        }