RegistrationLeterReults IsValiDateRegistration(RegistrationLesterRequest lesterModel)
        {
            RegistrationLeterReults result = new RegistrationLeterReults();

            result.MessageCode = MessgeCodeRegistration.IsValidate;
            var user = UserExists(lesterModel.UserName);

            if (user != null)
            {
                result.MessageCode = MessgeCodeRegistration.ExistName;
                return(result);
            }
            //if (!CommonHelper.IsValidEmail(lesterModel.Email))
            //{
            //    result.MessageCode = MessgeCodeRegistration.AccountEmailWrong;
            //    return result;
            //}
            var userEmail = _userService.GetUserByEmail(lesterModel.Email);

            if (userEmail != null)
            {
                result.MessageCode = MessgeCodeRegistration.ExistEmail;
                return(result);
            }
            if (string.IsNullOrWhiteSpace(lesterModel.Password))
            {
                result.MessageCode = MessgeCodeRegistration.PasswordWrong;
                return(result);
            }
            return(result);
        }
        Auth_User CreateUserForLester(RegistrationLesterRequest lesterModel, string passwordHash)
        {
            var userNew = new Auth_User()
            {
                CreatedTime  = DateTime.Now,
                PasswordHash = passwordHash,
                Email        = lesterModel.Email,
                PhoneNumber  = lesterModel.PhoneNumber,
                Status       = (int)EnumStatusUser.Approved,
            };

            if (!string.IsNullOrEmpty(lesterModel.Email))
            {
                userNew.UserName = lesterModel.Email;
            }
            else if (!string.IsNullOrEmpty(lesterModel.PhoneNumber))
            {
                userNew.UserName = lesterModel.PhoneNumber.Split('@').First();;
            }
            else
            {
                userNew.UserName = lesterModel.FacebookId;
            }
            return(_userService.InsertUserLester(userNew));
        }