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); }
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); } }
public CustomersController(MiniInvoiceContext context) { _context = context; }