public bool Delete() { try { DALC.Region region = Common.ModeloEntidad.Region.First(f => f.Region_ID == this.Region_ID); Common.ModeloEntidad.Region.Remove(region); Common.ModeloEntidad.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public bool Read() { try { DALC.Region region = Common.ModeloEntidad.Region.First(f => f.Region_ID == this.Region_ID); this.Region_ID = region.Region_ID; this.Nombre = region.Nombre; return(true); } catch (Exception ex) { return(false); } }
public bool Update() { try { DALC.Region region = Common.ModeloEntidad.Region.First(f => f.Region_ID == this.Region_ID); region.Region_ID = this.Region_ID; region.Nombre = this.Nombre; Common.ModeloEntidad.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public bool Create() { try { DALC.Region region = new DALC.Region(); region.Region_ID = this.Region_ID; region.Nombre = this.Nombre; Common.ModeloEntidad.Region.Add(region); Common.ModeloEntidad.SaveChanges(); return(true); } catch (Exception ex) { Common.ModeloEntidad.Region.Local.Clear(); return(false); } }