Пример #1
0
        /// <summary>
        ///     Invalidates user data -> regenerates verification code and sets Verified property of user data to false.
        ///     This method was used in UserInternalApiController.EditUserAsync before the invalidation process of userdata was moved into UserManager.UpdateUser, now is obsolete, however it can be used when need to explicitly invalidate UserData.
        /// </summary>
        /// <param name="userId">Id of user, whose data should be invalidated</param>
        /// <returns></returns>
        public DataResult <bool> InvalidateUserData(int userId)
        {
            var generaCodeResult = RegenerateVerificationCode(userId);

            if (generaCodeResult.HasError)
            {
                return(Error <bool>(generaCodeResult.Error.Message, DataResultErrorCode.CreateUserErrorGenerateVerificationCode));
            }

            try
            {
                m_userUoW.InvalidateUserData(userId);
            }
            catch (DatabaseException e)
            {
                m_logger.LogWarning(e);
                return(Error <bool>(e.Message));
            }

            return(Success(true));
        }