コード例 #1
0
ファイル: RoleManagerApp.cs プロジェクト: Qasimovrufat/Dahliz
        public static RoleManagerApp CreateRoleManager(IdentityFactoryOptions <RoleManagerApp> identityFactoryOptions, IOwinContext owinContext)
        {
            WheelDbContext context = owinContext.Get <WheelDbContext>();
            RoleManagerApp role    = new RoleManagerApp(new RoleStore <RoleApp>(context));

            return(role);
        }
コード例 #2
0
 public JsonResult DeleteTyreBrand(int id)
 {
     try
     {
         var at        = new WheelDbContext();
         var tyreBrand = Db.TyreBrand.FirstOrDefault(tb => tb.Id == id);
         if (tyreBrand == null)
         {
             return(Json(new { Result = "ERROR", Message = "there is not any TyreBrand Like this id!" }));
         }
         Db.TyreBrand.Remove(tyreBrand);
         Db.SaveChanges();
         return(Json(new { Result = "OK", Record = tyreBrand }));
     }
     catch (Exception ex)
     {
         Response.StatusCode = 400;
         return(Json(new { Result = "ERROR", Message = ex.Message }));
     }
 }
コード例 #3
0
        public static UserManagerApp CreateUserManager(IdentityFactoryOptions <UserManagerApp> identityFactoryOptions, IOwinContext owinContext)
        {
            WheelDbContext context = owinContext.Get <WheelDbContext>();
            UserManagerApp user    = new UserManagerApp(new UserStore <UserApp>(context));

            Microsoft.AspNet.Identity.PasswordValidator passwordValidator = new PasswordValidator
            {
                RequiredLength   = 6,
                RequireDigit     = true,
                RequireLowercase = true
            };

            UserValidator <UserApp> userValidator = new UserValidator <UserApp>(user)
            {
                RequireUniqueEmail             = true,
                AllowOnlyAlphanumericUserNames = true
            };

            user.UserValidator     = userValidator;
            user.PasswordValidator = passwordValidator;
            return(user);
        }