Lattice model of ionic liquid confined by metal electrodes