public UserAuthorizationInfo CreateUserAuthorizationInfo(ApplicationUser appUser)
 {
     return new UserAuthorizationInfo()
     {
         UserId = appUser.Id,
         UserName = appUser.UserName,
         //Roles = _AppUserManager.GetRolesAsync(appUser.Id).Result.ToList(),
         //Claims = _AppUserManager.GetClaimsAsync(appUser.Id).Result,
         //ClaimsIdentity = _AppUserManager.CreateIdentity(appUser, "Token")
     };
 }
 public UserDataModel CreateUserDataModel(ApplicationUser appUser)
 {
     return new UserDataModel
     {
         FullName = string.Format("{0} {1}", appUser.FirstName, appUser.LastName),
         Email = appUser.Email,
         UserName = appUser.UserName,
         UserId = appUser.Id,
         MobileNumber = appUser.PhoneNumber
     };
 }
 public UserReturnModel Create(ApplicationUser appUser)
 {
     return new UserReturnModel
     {
         Id = appUser.Id,
         UserName = appUser.UserName,
         FullName = string.Format("{0} {1}", appUser.FirstName, appUser.LastName),
         Email = appUser.Email,
         EmailConfirmed = appUser.EmailConfirmed,
       
         //Roles = appUser.Roles != null ? appUser.Roles.Select(c => c.)
         
         //Roles = _AppUserManager.GetRolesAsync(appUser.Id).Result,
         //Claims = _AppUserManager.GetClaimsAsync(appUser.Id).Result
         
         //JoinDate = appUser.JoinDate,
         //Level = appUser.Level,
     };
 }
        public GenericActionResult<UserReturnModel> CreateUser(CreateUserBindingModel user, string password)
        {
            var newUser = new ApplicationUser()
            {
                UserName = user.Email,
                Email = user.Email,
                FirstName = user.FirstName,
                LastName = user.LastName,
                PhoneNumber = user.MobileNumber
            };

            IdentityResult addUserResult = this.Create(newUser, password);

            var result = new GenericActionResult<UserReturnModel>()
            {
                IsSuccess = addUserResult.Succeeded,
                Errors = addUserResult.Errors,
                Result = addUserResult.Succeeded ? _modelFactory.Create(newUser) : null
            };

            return result;
        }