//constructor public AccountController(OMDB_Context _c, IHostingEnvironment _ae, MailKitService _mks, OauthManager _om) { db = _c; appEnvironment = _ae; mailService = _mks; oauthManager = _om; }
public TitlesController(IHostingEnvironment _ae, OMDB_Context _c, MailKitService _mk) { appEnvironment = _ae; db = _c; mailService = _mk; genres = (from gen in _c.Genres select gen.RuGenreName).ToList(); genres.Add("все"); }
public MailKitService(OMDB_Context omdb) { client = new SmtpClient(); try { db = omdb; client.Connect("smtp.yandex.com", 25, false); client.Authenticate(AuthLogin, AuthPassword); } catch (Exception e) { Console.WriteLine(e.Message + " " + e.InnerException?.Message); } }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, OMDB_Context db, IHttpContextAccessor hca) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseStatusCodePagesWithReExecute("/StatusCodes/Index", "?statusCode={0}"); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); //app.Use(async (context, next) => //{ // if (context.User.Identity.IsAuthenticated) // { // context.Response.Redirect("../Account/Login"); // string sId = context.User.FindFirst("Id").Value; // User checkUser = await db.Users.FirstOrDefaultAsync(u => u.Id.ToString() == sId); // if (checkUser.IsBanned || checkUser.BannedFor.Value > DateTime.Now) // { // hca.HttpContext.Response.Redirect("../Account/Login"); // } // } // await next.Invoke(); //}); }
public GenresController(OMDB_Context context, MailKitService _mk) { db = context; mailService = _mk; }
public SearchController(OMDB_Context _c) { db = _c; }
public MoviesInUsersListsController(OMDB_Context context) { db = context; }
public HomeController(OMDB_Context _c, OauthManager _om) { db = _c; }