예제 #1
0
        public DataResult <bool> RemoveRoleFromUser(int userId, int roleId)
        {
            try
            {
                m_userUoW.RemoveRoleFromUser(userId, roleId);

                return(Success(true));
            }
            catch (NoResultException <UserEntity> e)
            {
                m_logger.LogWarning(e);
                return(Error <bool>(m_translator.Translate("invalid-user-id"), DataResultErrorCode.UserNotExistId));
            }
            catch (NoResultException <RoleEntity> e)
            {
                m_logger.LogWarning(e);
                return(Error <bool>(m_translator.Translate("invalid-role-id"), DataResultErrorCode.RoleNotExistId));
            }
            catch (DatabaseException e)
            {
                m_logger.LogWarning(e);
                return(Error <bool>(e.Message));
            }
        }