public bool Delete() { try { DALC.Bodega bodega = Common.ModeloEntidad.Bodega.First(f => f.Bodega_ID == this.Bodega_ID); Common.ModeloEntidad.Bodega.Remove(bodega); Common.ModeloEntidad.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public bool Update() { try { DALC.Bodega bodega = Common.ModeloEntidad.Bodega.First(f => f.Bodega_ID == this.Bodega_ID); bodega.Nombre = this.Nombre; bodega.Ubicacion_ID = this.Ubicacion_ID; Common.ModeloEntidad.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public bool Read() { try { DALC.Bodega bodega = Common.ModeloEntidad.Bodega.First(f => f.Bodega_ID == this.Bodega_ID); this.Bodega_ID = bodega.Bodega_ID; this.Nombre = bodega.Nombre; this.Ubicacion_ID = bodega.Ubicacion_ID; return(true); } catch (Exception ex) { return(false); } }
public bool Create() { try { DALC.Bodega bodega = new DALC.Bodega(); bodega.Nombre = this.Nombre; bodega.Bodega_ID = this.Bodega_ID; bodega.Ubicacion_ID = this.Ubicacion_ID; Common.ModeloEntidad.Bodega.Add(bodega); Common.ModeloEntidad.SaveChanges(); return(true); } catch (Exception ex) { string test = ex.ToString(); Common.ModeloEntidad.Bodega.Local.Clear(); return(false); } }