public bool borrarEmpresa() { try { DALC.EMPRESA empresa = CommonBC.Modelo.EMPRESA.FirstOrDefault(us => us.RUT == this.Rut); CommonBC.Modelo.EMPRESA.Remove(empresa); CommonBC.Modelo.SaveChanges(); return(true); } catch (Exception ex) { Logger.Log(ex.Message); return(false); } }
public bool actualizarEmpresa() { try { DALC.EMPRESA empresa = CommonBC.Modelo.EMPRESA.FirstOrDefault(us => us.RUT == this.Rut); empresa.RAZON_SOCIAL = this.RazonSocial; empresa.GIRO = this.Giro; empresa.DIRECCION = this.Direccion; empresa.TELEFONO = this.Telefono; empresa.USUARIO_ID = this.UsuarioId; CommonBC.Modelo.SaveChanges(); return(true); } catch (Exception ex) { Logger.Log(ex.Message); return(false); } }
public bool agregarEmpresa() { DALC.EMPRESA emp = new DALC.EMPRESA(); try { emp.RUT = this.Rut; emp.RAZON_SOCIAL = this.RazonSocial; emp.GIRO = this.Giro; emp.DIRECCION = this.Direccion; emp.TELEFONO = this.Telefono; emp.USUARIO_ID = this.UsuarioId; CommonBC.Modelo.EMPRESA.Add(emp); CommonBC.Modelo.SaveChanges(); return(true); } catch (Exception ex) { CommonBC.Modelo.EMPRESA.Remove(emp); Logger.Log(ex.Message); return(false); } }