West Ham have beaten relegation-haunted Leicester City 2-0 in the Premier League, a result that took the Foxes a step closer to the Championship.