public bool Read() { Datos.OnTourEntities1 bbdd = new Datos.OnTourEntities1(); try { Datos.Contratos con = bbdd.Contratos.First(e => e.rut_rep == rut_rep); CommonBC.Syncronize(con, this); return(true); } catch (Exception) { return(false); } }
public bool Delete() { Datos.OnTourEntities1 bbdd = new Datos.OnTourEntities1(); try { Datos.Contratos con = bbdd.Contratos.First(e => e.rut_rep == rut_rep); bbdd.Contratos.Remove(con); bbdd.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool Update() { Datos.OnTourEntities1 bbdd = new Datos.OnTourEntities1(); try { Datos.Contratos con = bbdd.Contratos.First(e => e.rut_rep == rut_rep); CommonBC.Syncronize(this, con); bbdd.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool Create() { Datos.OnTourEntities1 bbdd = new Datos.OnTourEntities1(); Datos.Contratos con = new Datos.Contratos(); try { CommonBC.Syncronize(this, con); bbdd.Contratos.Add(con); bbdd.SaveChanges(); return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); bbdd.Contratos.Remove(con); return(false); } }