示例#1
0
        /// <summary>
        /// Registers the user.
        /// </summary>
        /// <param name="userModel">The user model.</param>
        /// <returns>
        /// Registration result message
        /// </returns>
        public async Task <ResultMessage <bool> > RegisterUser(UserModel userModel)
        {
            var result = new ResultMessage <bool>();

            IdentityResult regResult = null;

            try
            {
                regResult = await this.authRepository.RegisterUser(userModel);

                result.Item = true;
            }
            catch (Exception ex)
            {
                this.LoggerService.LogException("Register: " + ex.Message);
                this.ModelState.AddModelError("Exception", ex.Message);
            }

            result.Messages.AddRange(regResult.ToMessages());

            return(result);
        }