title: Hangfire recurring job at a specific time ASP MVC
body: <p>Ive been recently using hangfire to process lengthy jobs enabling me to return API calls more efficiently within an ASP MVC Core application.</p>
  
  <p>i have implimented this by adding the following to startup.cs</p>
  
  <pre><code>public class Startup
  {
  
      public IConfigurationRoot Configuration { get; }
  
      public void ConfigureServices(IServiceCollection services)
      {
          services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt;
          options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
  
          services.AddCors(options =&gt; options.AddPolicy("AllowAll", p =&gt; p.AllowAnyOrigin()));
          services.AddHangfire(configuration =&gt; configuration.UseSqlServerStorage(Configuration.GetConnectionString("DefaultConnection")));
      }
  
      // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
      public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
      {
          loggerFactory.AddConsole(Configuration.GetSection("Logging"));
          loggerFactory.AddDebug();
  
          app.UseCors("AllowAll");
  
          app.UseMvc();
  
          app.UseHangfireDashboard();
          app.UseHangfireServer();     
      }
  </code></pre>
  
  <p>and then calling this within an action on a controller</p>
  
  <pre><code>  using (new BackgroundJobServer())
                      {
                          formData.DateCreated = DateTime.Now;
                          formData.Source = "Web";
                          formData.StatusItem =  _context.Status.FirstOrDefault(x =&gt; x.Default == true);
  
                          _context.Lead.Add(formData);
                          _context.SaveChanges();
                      }
  </code></pre>
  
  <p>Now i have a need to send a an email at 1am every day with the status of records from the database.</p>
  
  <p>Im slightly confused on the implementation from the following perspective:</p>
  
  <p>-Where do i implement the background job?
  -Do i put the call in a method, if so how is this called/
  -I cannot find BackgroundJob.AddOrUpdate, which i understand is used for the recurring tasks
  -The schedule method takes a timespan object, but all examples are using CRON.</p>
  
  <p>I have all the code to create the email, i just need help scheduling it</p>
  
  <p>Thanks for your help  in advance.</p>