ยง 7806. Judgment. The judgment may grant the petitioner the relief to which he is entitled, or may dismiss the proceeding either on the merits or with leave to renew. If the proceeding was brought to review a determination, the judgment may annul or confirm the determination in whole or in part, or modify it, and may direct or prohibit specified action by the respondent. Any restitution or damages granted to the petitioner must be incidental to the primary relief sought by the petitioner, and must be such as he might otherwise recover on the same set of facts in a separate action or proceeding suable in the supreme court against the same body or officer in its or his official capacity.