Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, FoodieDbContext context, IEmailSender emailSender, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "StrategyGame Web API V1");
            });

            app.UseHangfireDashboard();

            var manager = new RecurringJobManager();

            manager.AddOrUpdate("SendRecipe", Job.FromExpression(() => new DailyRecipes(context, emailSender).SendRecipes()), Cron.Daily());


            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseSession();

            app.UseProblemDetails();
            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapRazorPages();
                endpoints.MapControllers();
                endpoints.MapHangfireDashboard();
            });
        }
 public AuthRepository(FoodieDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Ejemplo n.º 3
0
 public RecipeService(FoodieDbContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
Ejemplo n.º 4
0
 public static void SeedData(FoodieDbContext dbContext)
 {
     System.Console.WriteLine("Applying Migration");
     dbContext.Database.Migrate();
 }
Ejemplo n.º 5
0
 public DailyRecipes(FoodieDbContext context, IEmailSender emailSender)
 {
     this.context     = context;
     this.emailSender = emailSender;
     this.random      = new Random();
 }
 public EventRepository(FoodieDbContext context)
 {
     dbContext = context;
 }