public bool CrearSucursal() { try { DALC.QueOfrecesEntities ctx = new DALC.QueOfrecesEntities(); DALC.SUCURSALES suc = new DALC.SUCURSALES(); suc.DIRECCION = this.Direccion; suc.EMAIL = this.Email; suc.COMUNA_ID = this.IdComuna; suc.REGION_ID = this.IdRegion; suc.RETAIL_ID = this.IdRetail; suc.ID_SUCURSAL = this.IdSucursal; suc.NOMBRE = this.Nombre; suc.RAZON_SOCIAL = this.RazonSocial; suc.RUT = this.Rut; suc.TELEFONO = this.Telefono; ctx.SUCURSALES.Add(suc); ctx.SaveChanges(); ctx = null; return(true); } catch (Exception) { return(false); } }
public bool EliminarSucursal() { try { DALC.QueOfrecesEntities ctx = new DALC.QueOfrecesEntities(); DALC.SUCURSALES suc = ctx.SUCURSALES.First(o => o.ID_SUCURSAL == IdSucursal); ctx.Entry(suc).State = System.Data.EntityState.Deleted; ctx.SaveChanges(); ctx = null; return(true); } catch (Exception) { return(false); } }