Exemplo n.º 1
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddSession();
     services.AddMemoryCache();
     services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
     services.AddScoped(sp => Kocsi.GetKocsi(sp));
     services.AddDbContext <ApplicationDbContext>(options =>
                                                  options.UseSqlServer(
                                                      Configuration.GetConnectionString("DefaultConnection")));
     services.AddDefaultIdentity <IdentityUser>(options =>
     {
         options.SignIn.RequireConfirmedAccount  = false;
         options.Password.RequiredLength         = 5;
         options.Password.RequireLowercase       = false;
         options.Password.RequireUppercase       = false;
         options.Password.RequireNonAlphanumeric = false;
         options.Password.RequireDigit           = false;
     })
     .AddRoles <IdentityRole>()
     .AddEntityFrameworkStores <ApplicationDbContext>();
     services.AddControllersWithViews();
     services.AddRazorPages();
     // itt álithatok a policyik a viewnek(jelenegiek:éttermi roleban van-e a felhasználó)
     services.AddAuthorization(
         options => {
         options.AddPolicy("Étteremeknek", policy => policy.RequireRole("Étterem"));
         options.AddPolicy("Vendégeknek", policy => policy.RequireRole("Vendég"));
         options.AddPolicy("Futároknak", policy => policy.RequireRole("Futár"));
     }
         );
 }
Exemplo n.º 2
0
 public KosarSzam(Kocsi kocsi)
 {
     _kocsi = kocsi;
 }
Exemplo n.º 3
0
 public KocsiController(ApplicationDbContext context, Kocsi kocsi)
 {
     _context = context;
     _kocsi   = kocsi;
 }
Exemplo n.º 4
0
 public RendelesController(ApplicationDbContext context, Kocsi kocsi, UserManager <IdentityUser> userManager)
 {
     _context     = context;
     _kocsi       = kocsi;
     _userManager = userManager;
 }