Example #1
0
        public async Task <List <Customer> > Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "v2/customer/{*customerId}")] HttpRequest req,
            ILogger log, string customerId)
        {
            log.LogInformation("---> Function Clientes invocada...");

            int id = ExtractId(customerId);

            if (id == 0)
            {
                log.LogInformation("[FClientes] Listagem completa de clientes");
                return(_customerDomain.GetCustomers());
            }
            else
            {
                log.LogInformation("[FClientes] Listagem individual de cliente");
                Customer customer = _customerDomain.GetCustomer(id);
                if (customer != null)
                {
                    return new List <Customer>()
                           {
                               customer
                           }
                }
                ;
            }

            return(null);
        }