Пример #1
0
 public static IdentityResult CreateUser <TUser, TKey>(this UserManager <TUser, TKey> manager, TUser user, string password)
     where TUser : class, IUser <TKey>
     where TKey : IEquatable <TKey>
 {
     //var result = manager.FindByName(user.UserName);
     if (manager.FindByName(user.UserName) == null)
     {
         var result = manager.Create(user, password);
         manager.SetLockoutEnabled(user.Id, false);
         return(result);
     }
     return(null);
 }