work the whole time is OK on it's own, although we would normally say I've been working the whole time.
(Present perfect continuous)
Work for the whole time doesn't really make sense alone it could be said in a sentence such as;
I had to work for the whole time you were away.
But, it doesn't sound natural in speech.