public bool Delete() { try { LOG_PRECIO log = CommonBC.DBConexion.LOG_PRECIO.First(l => l.ID == this.Id); CommonBC.DBConexion.LOG_PRECIO.Remove(log); CommonBC.DBConexion.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool Read() { try { LOG_PRECIO log = CommonBC.DBConexion.LOG_PRECIO.First(l => l.ID == this.Id); this.Fecha = log.FECHA; this.PrecioAntiguo = (int)log.PRECIO_ANTIGUO; this.PrecioNuevo = (int)log.PRECIO_NUEVO; return(true); } catch (Exception) { return(false); } }
public bool Update() { try { LOG_PRECIO log = CommonBC.DBConexion.LOG_PRECIO.First(l => l.ID == this.Id); log.FECHA = this.Fecha; log.PRECIO_ANTIGUO = this.PrecioAntiguo; log.PRECIO_NUEVO = this.PrecioNuevo; CommonBC.DBConexion.Entry(log).State = System.Data.EntityState.Modified; CommonBC.DBConexion.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool Create() { try { LOG_PRECIO log = new LOG_PRECIO(); log.ID = this.Id; log.FECHA = this.Fecha; log.PRECIO_ANTIGUO = this.PrecioAntiguo; log.PRECIO_NUEVO = this.PrecioNuevo; CommonBC.DBConexion.LOG_PRECIO.Add(log); CommonBC.DBConexion.SaveChanges(); return(true); } catch (Exception) { return(false); } }