public static bool Modificar(FacturaDetalles detalle) { using (var conexion = new DigitalServicesDB()) { try { if (Buscar(detalle.Id) != null) { conexion.Entry(detalle).State = EntityState.Modified; if (conexion.SaveChanges() > 0) { return(true); } } else { return(Guardar(detalle)); } } catch (Exception) { throw; } } return(false); }
public static bool Eliminar(FacturaDetalles detalle) { using (var conexion = new DigitalServicesDB()) { try { var item = BLL.ItemsBLL.Buscar(detalle.IdItem); int cant = detalle.Cantidad; conexion.Entry(detalle).State = EntityState.Deleted; if (conexion.SaveChanges() > 0) { if (item.EsArticulo == 1) { item.Existencia = item.Existencia + cant; return(BLL.ItemsBLL.Modificar(item)); } return(true); } } catch (Exception) { throw; } } return(false); }
public static bool Eliminar(Clientes cliente) { using (var conexion = new DigitalServicesDB()) { try { conexion.Entry(cliente).State = EntityState.Deleted; if (conexion.SaveChanges() > 0) { return(true); } } catch (Exception) { throw; } } return(false); }
public static bool Modificar(Items item) { using (var conexion = new DigitalServicesDB()) { try { conexion.Entry(item).State = System.Data.Entity.EntityState.Modified; if (conexion.SaveChanges() > 0) { return(true); } } catch (Exception) { throw; } } return(false); }
public static bool Modificar(Usuarios usuario) { using (var conexion = new DigitalServicesDB()) { try { conexion.Entry(usuario).State = EntityState.Modified; if (conexion.SaveChanges() > 0) { return(true); } } catch (Exception) { throw; } } return(false); }
public static bool ModificarEncabezado(int?facturaId) { using (var conexion = new DigitalServicesDB()) { try { conexion.Entry(BuscarEncabezado(facturaId)).State = EntityState.Modified; if (conexion.SaveChanges() > 0) { return(true); } } catch (Exception) { throw; } } return(false); }
public static bool Eliminar(EncabezadoDetalle factura) { bool resultado = false; using (var conexion = new DigitalServicesDB()) { try { if (BLL.FacturaDetalleBLL.Eliminar(factura.Detalle)) { conexion.Entry(factura.Encabezado).State = EntityState.Deleted; resultado = conexion.SaveChanges() > 0; } } catch (Exception) { throw; } } return(resultado); }
public static bool Modificar(EncabezadoDetalle factura) { bool resultado = false; using (var conexion = new DigitalServicesDB()) { try { conexion.Entry(factura.Encabezado).State = EntityState.Modified; if (conexion.SaveChanges() > 0) { resultado = FacturaDetalleBLL.Modificar(factura.Detalle); } } catch (Exception) { throw; } } return(resultado); }