In general you would want to eat something before and after your workout. That way you will feel energetic during your workout because your body has just recieved fuel. And after your workout you provide your body with calories, preferably some coming from protien, to repair the damaged muscles. You might want to leave some time between the meal before your workout and the workout, because digestion takes some time and slows down during physical activity. Also training with a full stomach can make for an uncomfortable experience depending on the type of activity. However the time between the workout and meal depends mainly on personal preference.
When it comes to eating after a workout it is preferable to consume some protien as soon as possible to stimulate muscle growth. Now eating right before going to bed does not cause significant weight gain or loss, but a spike in bloodsugar from eating could make it harder for you to fall asleep. A way to prevent this is to make sure you don't eat to much sugar and focus more on meals with carbohydrates containing fiber. This way it will take your body longer to absorb the energy and the blood sugar spike will flatten out over time.
All things considered it does not matter much whether you eat the biggest part of your meal before or after the workout, as long as you have energy to preform well and eat some protein afterward.
If you find yourself pressed for time when trying to eat after workouts you might want to consider preparing meals for after a couple of workouts at a time.