My MacBook Air won't charge
Because you explain the problem perfectly, and in short:


The battery does not charge, and your Macbook does only work with MagSafe attached


There's only one option what could be the problem...

The battery is dead, let me explain you why:


Your battery is ignored somehow, and your Macbook uses power directly from the MagSafe adapter. If you couldn't even use the Macbook with the cable in it, the cable could be the problem. Since it works with cable-attached, it's not.
You can use the macbook with cable in it as explained above.