public static bool EliminarProducto(Producto producto) { bool response = false; try { using (var dbContextScope = new DigitalWareEntities()) { var productoConsulta = dbContextScope.Producto.Where(x => x.Id == producto.Id).FirstOrDefault(); if (productoConsulta != null) { dbContextScope.Producto.Remove(productoConsulta); dbContextScope.SaveChanges(); response = true; } } } catch (Exception ex) { response = false; throw ex; } return(response); }
public static bool EditarFacturaProducto(FacturaProducto facturaProducto) { bool response = false; try { using (var dbContextScope = new DigitalWareEntities()) { var facturaProductoConsulta = dbContextScope.FacturaProducto.Where(x => x.Id == facturaProducto.Id).FirstOrDefault(); if (facturaProductoConsulta != null) { FrammeworkTypeUtility.SetProperties(facturaProducto, facturaProductoConsulta); dbContextScope.SaveChanges(); response = true; } } } catch (Exception ex) { response = false; throw ex; } return(response); }
public static bool EliminarFactura(Factura factura) { bool response = false; try { using (var dbContextScope = new DigitalWareEntities()) { var facturaConsulta = dbContextScope.Factura.Where(x => x.Id == factura.Id).FirstOrDefault(); if (facturaConsulta != null) { dbContextScope.Factura.Remove(facturaConsulta); dbContextScope.SaveChanges(); response = true; } } } catch (Exception ex) { response = false; throw ex; } return(response); }
public static bool EliminarCliente(Cliente cliente) { bool response = false; try { using (var dbContextScope = new DigitalWareEntities()) { var clienteConsulta = dbContextScope.Cliente.Where(x => x.Id == cliente.Id).FirstOrDefault(); if (clienteConsulta != null) { dbContextScope.Cliente.Remove(clienteConsulta); dbContextScope.SaveChanges(); response = true; } } } catch (Exception ex) { response = false; throw ex; } return(response); }
public static List <Producto> ObtenerProductos() { try { using (var dbContextScope = new DigitalWareEntities()) { return(dbContextScope.Producto.ToList()); } } catch (Exception ex) { throw ex; } }
public static List <FacturaProductos> ObtenerFacturaProductos(int clienteId) { try { using (var dbContextScope = new DigitalWareEntities()) { return(dbContextScope.ObtenerFacturaProductos(clienteId).ToList()); } } catch (Exception ex) { throw ex; } }
public static List <Cliente> ObtenerClientes() { try { using (var dbContextScope = new DigitalWareEntities()) { return(dbContextScope.Cliente.ToList()); } } catch (Exception ex) { throw ex; } }
public static bool CrearProducto(Producto producto) { bool response = false; try { using (var dbContextScope = new DigitalWareEntities()) { dbContextScope.Producto.Add(producto); dbContextScope.SaveChanges(); response = true; } } catch (Exception ex) { throw ex; } return(response); }
public static bool CrearFactura(Factura factura) { bool response = false; try { using (var dbContextScope = new DigitalWareEntities()) { dbContextScope.Factura.Add(factura); dbContextScope.SaveChanges(); response = true; } } catch (Exception ex) { throw ex; } return(response); }
public static bool CrearCliente(Cliente cliente) { bool response = false; try { using (var dbContextScope = new DigitalWareEntities()) { dbContextScope.Cliente.Add(cliente); dbContextScope.SaveChanges(); response = true; } } catch (Exception ex) { throw ex; } return(response); }