Peel and chop the onion and garlic and fry in a little oil. Wash and chop tomatoes and mushrooms. Add the corn, tomato paste and ham to the onions and garlic in the pan. Sprinkle flour over it, sweat, deglaze with cream and simmer for 5 minutes.
Mix the gnocchi and the sauce in a baking dish. Chop the mozzarella and sprinkle with the grated cheese over the casserole.
Bake in a hot oven at 200 ° C for about 30 minutes.