示例#1
0
        public async Task <UserIdentityResult> AddNewUserAsync(AddUserRequest addUser, string password)
        {
            try
            {
                if (addUser.isActive.ToLower() != "true")
                {
                    addUser.isActive = "false";
                }
                var userId = await _usersData.AddNewUserAsync(addUser, password);

                return(new UserIdentityResult
                {
                    Id = userId,
                    Succeeded = true,
                    Errors = null
                });
            }
            catch (Exception e)
            {
                return(new UserIdentityResult
                {
                    Id = 0,
                    Succeeded = false,
                    Errors = new[] { e.Message }
                });
            }
        }