Also, note that it is important to understand what kind of work you are calculating:
The problem is asking to calculate the work done against gravity. It is implied that some external force is pushing the force up the incline, but we do not no anything about this force. All we know that the work performed by this force must be equal and opposite to the work performed by gravity, because the box is moving with constant speed (if the external work was greater, the box would accelerate, if it was smaller, the box would not move.)
To calculate the work performed by gravity, we need to multiply the magnitude of the force (mg) by the magnitude of displacement (L = 5 m) by the cosine of angle between these two angles (120 degrees, since gravity is pointing down, and displacement vector is pointing up the incline.)
So `W_(gravity) = mgLcos(120) = -245 J`
Notice that the negative sign is consistent with the fact that the gravity is working against the motion, which is up the incline.
So the work performed by external force must be `W_(external) = -W_(gravity) = 245` J.
Another way to look at the formula is that it is the product of gravity, mg, and "vertical displacement", which is Lsin(30) = Lcos(60), which is how your first result was obtained. And, as mentioned in the answer above, this work equals the change in the box's potential energy.
The problem with your second answer is that if you assume that the external force is parallel to the incline and balances out the component of the gravity parallel to incline (which is okay to assume, since this results in the box's motion with constant speed), and calculate this force, as you have done correctly
`F_(||) = mgsin(30) = 49 N`
then to calculate the work of this force, you need to multiply it by the magnitude of the displacement, L = 5m, (not vertical displacement !) and the cosine of the angle between the `vecF_(||)` and the displacement, which is 0, because both parallel force and displacement are directed up the incline. Since cos(0) = 1,
`W_(||) = mgsin(30)L = 245 J` .
The work of external force is 245 J, same result we obtained before.
Your first answer is correct. It's a common misconception that simple machines (levers, ramps, pulleys, wheel and axle, wedges, screws) make less work. They do not make less work. The reason simple machines make it feel like you are doing less work is because they usually reduce force. Each machine allows a user to reduce force by trading distance. A ramp will reduce how much force a person uses, but the box must move further.
For example, I can lift a box straight up to a height of 2 meters. If it requires a force of 10 Newtons, then the total work being done is 20 J (force x distance). Or I could push it up to that same height using a ramp. The box reaches the same height, and I didn't have to push/pull so hard. Suppose my force was reduced to 2 Newtons using the ramp. That's great, but that means I had to push the box up a 10 meter long ramp.
Your question is equivalent to using no ramp at all, because it is frictionless. No work is being done to overcome the friction of the ramp, so it's no different than a dead lift. Your horizontal and vertical force may have been reduced, but the work done to get the box to that height is the same with or without the ramp.
Another way to look at it is to use gravitational potential energy. It's measured in Joules the same as work. If 50 J of work was used to lift a box to a certain height, then it has 50 J of gravitational potential energy. Think about your ramp. If there was no ramp, a friction ramp, or a no friction ramp, the box still ends up at the same height. In all cases it has the same amount of potential energy. Same potential energy, same amount of work.
A frictionless ramp is the only kind of ramp that will give you ideal work (work without friction). Any other ramp actually requires more work to lift the box, because some of your input energy is being used to overcome the friction of the ramp itself.