Fish gasping at the surface is usually low oxygen levels in the water, which can be caused by high temperatures, chemicals or salt. It can also be caused by gill fluke, gill fungus and bacteria on the gills. Fish that are dying will usually stop eating and breath rapidly near the surface or a filter outlet because there is more oxygen there.
Fish that stop eating can have internal problems or something is wrong with the water. Poor water quality, exposure to too many chemicals or high doses of chemicals, and internal infections can cause them to stop eating.