Exemplo n.º 1
0
        public DataResult <bool> AssignRolesToUser(int userId, IEnumerable <int> rolesIds)
        {
            try
            {
                m_userUoW.AssignRolesToUser(userId, rolesIds);

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