Beispiel #1
0
 public int InsertarPais(Pais pais)
 {
     using (EFDemoEntities context = new EFDemoEntities())
     {
         context.Pais.AddObject(pais);
         return(context.SaveChanges());
     }
 }
Beispiel #2
0
 public int Modificar(Pais pais)
 {
     using (EFDemoEntities context = new EFDemoEntities())
     {
         context.Pais.ApplyChanges(pais);
         return(context.SaveChanges());
     }
 }
Beispiel #3
0
 public int ModificarPaisPorId(int id)
 {
     using (EFDemoEntities context = new EFDemoEntities())
     {
         Pais pais = (from p in context.Pais
                      where p.Id == id
                      select p).FirstOrDefault();
         pais.Nombre = "Editadote";
         context.Pais.ApplyChanges(pais);
         return(context.SaveChanges());
     }
 }