The governing bodies of the city and county may provide for the enforcement of any ordinance enacted under this Act [article], and a violation of any such ordinance shall be a misdemeanor, punishable by fine or imprisonment or both. In addition, the building officer, city or county attorney or other appropriate official, or affected property owner may institute injunction, mandamus or other appropriate action or proceeding to prevent or correct such violation.