예제 #1
0
        /// <summary>
        /// Deletes a user.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <returns>A void task.</returns>
        public async Task DeleteUser(int userId)
        {
            var exitingUser = await _userData.GetAsync <User>(userId);

            if (exitingUser == null)
            {
                throw new InvalidOperationException("User does not exist.");
            }

            await _userData.DeleteAsync(exitingUser);

            _adminLogService.LogNeutral($"User account deletion for {exitingUser.UserName} succeeded.", LogCategory.Security);
        }