コード例 #1
0
        protected void Application_Start()
        {
            //AreaRegistration.RegisterAllAreas();
            IdentityConfig.RegisterIdentities();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            //RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            MiaRealEstateDb               db          = new MiaRealEstateDb();
            RoleStore <ApplicationRole>   roleStore   = new RoleStore <ApplicationRole>(db);
            RoleManager <ApplicationRole> roleManager = new RoleManager <ApplicationRole>(roleStore);

            if (!roleManager.RoleExists("Admin"))
            {
                ApplicationRole adminRole = new ApplicationRole("Admin", "Sistem yöneticisi");
                roleManager.Create(adminRole);
            }

            if (!roleManager.RoleExists("User"))
            {
                ApplicationRole userRole = new ApplicationRole("User", "Sistem kullanıcısı, yorum eklemek için gereklidir");
                roleManager.Create(userRole);
            }
            // Rol tanımlama adımları
        }
コード例 #2
0
ファイル: Global.asax.cs プロジェクト: mustafa-issa/ChartMix
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     IdentityConfig.RegisterIdentities();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }