Can you patent an idea of a new invention?

Absolutely, that is the entire purpose of patents: to provide a protected means of disclosure of new inventions so that inventors can make profit off them without having to worry about fighting competition, thus encouraging them to invent even more.

Without patents the moment you brought your invention on the market anyone could copy it, unless some part of it could be kept a trade secret (which is very hard to maintain). With patents you disclose everything about the invention, with the knowledge it is legally your sole property for 17 years to do what you want with.