Ejemplo n.º 1
0
 public bool Eliminar()
 {
     try
     {
         EDM.Persona p = Conector.HotelEntities.Personas.ToList().Find(per => per.rut == Rut);
         Conector.HotelEntities.Personas.Remove(p);
         Conector.HotelEntities.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Ejemplo n.º 2
0
 public bool Modificar()
 {
     try
     {
         EDM.Persona p = Conector.HotelEntities.Personas.ToList().Find(per => per.rut == Rut);
         p.dv       = Dv.ToString();
         p.nombre   = Nombre;
         p.apellido = Apellidos;
         p.fechaNac = FechaNac;
         Conector.HotelEntities.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 public bool Insertar()
 {
     try
     {
         EDM.Persona persona = new EDM.Persona();
         persona.rut      = this.Rut;
         persona.dv       = this.Dv.ToString();
         persona.nombre   = this.Nombre;
         persona.apellido = this.Apellidos;
         persona.fechaNac = this.FechaNac;
         Conector.HotelEntities.Personas.Add(persona);
         Conector.HotelEntities.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }