public async Task Run([TimerTrigger("0 */5 * * * *", RunOnStartup = true)] TimerInfo myTimer) { _log.LogInformation($"StarterFunction Timer trigger function executed at: {DateTime.Now}"); // Example code to retrieve all ToDoItems and email "*****@*****.**" when time trigger is hit. var specification = new ToDoItemGetAllSpecification(false); var entities = await _repo.GetItemsAsync(specification); string messageBody = JsonSerializer.Serialize(entities); await _emailService.SendEmailAsync("*****@*****.**", "No Reply", "Todo Item Summary", messageBody); }
/// <summary> /// Handle /// </summary> /// <param name="query"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task <QueryResponse> Handle(GetAllQuery query, CancellationToken cancellationToken) { QueryResponse response = new QueryResponse(); // If needed, this is where to implement cache reading and setting logic //var cachedEntities = await _cachedToDoItemsService.GetCachedToDoItemsAsync(); //var entities = await _repo.GetItemsAsync($"SELECT * FROM c"); // Get all the incompleted todo items var specification = new ToDoItemGetAllSpecification(false); var entities = await _repo.GetItemsAsync(specification); response.Resource = entities.Select(x => _mapper.Map <ToDoItemModel>(x)); return(response); }