public async Task <IActionResult> Index() { // backgroundJob.Enqueue(() => Debug.WriteLine("Background Job completed successfully!")); await messagesService.AddAsync(new Message { Content = "Hey" }); backgroundJob.Enqueue(() => LongProcess()); backgroundJob.Enqueue <ISendRequest>(x => x.SendSmsAsync("Hello HangFire Async!")); RecurringJob.AddOrUpdate(() => Console.WriteLine("Daily Job"), Cron.Daily(23, 12)); return(View()); }
public async Task <bool> PostAsync([FromBody] Messages message) { return(await _messagesService.AddAsync(message)); }