Example #1
0
        public static void Run([QueueTrigger("customers", Connection = "StorageConnectionString")] string myQueueItem, ILogger log)
        {
            log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");



            byte[] data          = Convert.FromBase64String(myQueueItem);
            string decodedString = Encoding.UTF8.GetString(data);



            Customer customer = System.Text.Json.JsonSerializer.Deserialize <Customer>(decodedString);

            MiniInvoiceContext ctx = new MiniInvoiceContext();

            ctx.Customers.Add(customer);
        }
Example #2
0
        public static void Run([TimerTrigger("0 */5 * * * *"

                        #if DEBUG
                                             , RunOnStartup = true
            #endif

                                             )] TimerInfo myTimer, ILogger log)
        {
            log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");

            MiniInvoiceContext context = new MiniInvoiceContext();

            var customers = context.Customers.OrderBy(m => m.Name);

            foreach (var customer in customers)
            {
                log.LogInformation(customer.Name);
            }
        }
Example #3
0
 public CustomersController(MiniInvoiceContext context)
 {
     _context = context;
 }