Chosen Solution
21.5" iMac EMC 2428 loses internet connection often, my MacBook Air doesn’t!
How is each connected to the router?If both WiFi, are they on 2.4G or 5G?Have you verified the antenna position and connection?If on different channels, have you looked to see if there are any interfering signals on the imac channel?Have you verified the drivers are up to date?If all the above is good, then you may have a weak/bad adapter.
I would install this great App! WiFi Explorer so you can watch what is happening. You either are connecting over a bad band or the settings are messed up.