public int Criar(Jogo jogo)
 {
     using (var db = new BancoDeDados())
     {
         db.Entry(jogo).State = EntityState.Added;
         return db.SaveChanges();
     }
 }
 public int Excluir(int id)
 {
     using (var db = new BancoDeDados())
     {
         db.Entry(new Jogo(id)).State = System.Data.Entity.EntityState.Deleted;
         return db.SaveChanges();
     }
 }
 public int Criar(Jogo jogo)
 {
     using(banco = new BancoDeDados())
     {
         banco.Jogo.Add(jogo);
         return banco.SaveChanges();
     }
 }
 public int Excluir(int id)
 {
     using(banco= new BancoDeDados())
     {
         banco.Jogo.Remove(banco.Jogo.Find(id));
         return banco.SaveChanges();
     }
 }
 public int Atualizar(Jogo jogo)
 {
     using (var db = new BancoDeDados())
     {
         db.Entry(jogo).State = EntityState.Modified;
         return db.SaveChanges();
     }
 }
 public int Atualizar(Jogo jogo)
 {
     using (banco = new BancoDeDados())
     {
         banco.Entry(jogo).State = System.Data.Entity.EntityState.Modified;
         return banco.SaveChanges();
     }
 }
 public int Cadastrar(Usuario entidade)
 {
     using (var dataBase = new BancoDeDados())
     {
         dataBase.Entry(entidade).State = System.Data.Entity.EntityState.Added;
         return dataBase.SaveChanges();
     }
 }
 public int Devolucao(Locacao locacao)
 {
     using (var db = new BancoDeDados())
     {
         db.Entry(locacao).State = EntityState.Modified;
         return db.SaveChanges();
     }
 }
 public int Criar(Jogo entidade)
 {
     using (BancoDeDados db = new BancoDeDados())
     {
         db.Entry(entidade).State = System.Data.Entity.EntityState.Added;
         return db.SaveChanges();
     }
 }
 public int Criar(Locacao locacao)
 {
     using (var db = new BancoDeDados())
     {
         db.Entry(locacao).State = System.Data.Entity.EntityState.Added;
         return db.SaveChanges();
     }
 }
        public int Atualizar(Jogo entidade)
        {
            using(var dataBase = new BancoDeDados())
            {
                dataBase.Entry(entidade).State = System.Data.Entity.EntityState.Modified;

                return dataBase.SaveChanges();
            }
        }
 public int Excluir(int id)
 {
     using (var db = new BancoDeDados())
     {
         var query = db.Jogo.Where(j => j.Id == id).ToList();
         db.Entry(query).State = System.Data.Entity.EntityState.Deleted;
         return db.SaveChanges();
     }
 }
 public int Criar(Jogo jogo)
 {
     using (BancoDeDados db = new BancoDeDados())
     {
         db.Entry(jogo).State = System.Data.Entity.EntityState.Added;
         return db.SaveChanges();
     }
     throw new NotImplementedException();
 }
 public int Atualizar(Jogo jogo)
 {
     using (BancoDeDados db = new BancoDeDados())
     {
         db.Entry(jogo).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
         throw new NotImplementedException();
 }
 public int Excluir(int id)
 {
     using (var db = new BancoDeDados())
     {
         Jogo jogo = db.Jogo.Find(id);
         db.Entry(jogo).State = EntityState.Deleted;
         return db.SaveChanges();
     }
 }
 public int Atualizar(Locacao locacao)
 {
     using (var db = new BancoDeDados())
     {
         db.Entry(locacao.Jogo).State = System.Data.Entity.EntityState.Modified;
         db.Entry(locacao).State = System.Data.Entity.EntityState.Modified;
         return db.SaveChanges();
     }
 }
        public int Excluir(int id)
        {
            Jogo entidade = new Jogo(id);

            using (BancoDeDados db = new BancoDeDados())
            {
                db.Entry(entidade).State = System.Data.Entity.EntityState.Deleted;
                return db.SaveChanges();
            }
        }