//------------------------------------------------------------BUSCARPRODUCTO-------------------------------------------------------------------// public List <Venta> SearchProduct(int search) { using (Clsbdcontext cl = new Clsbdcontext()) { var query = (from x in cl.Venta where (x.Producto == search) select x).ToList(); return(query); } }
public List <Venta> TraerVentas(string fecha) { using (Clsbdcontext cl = new Clsbdcontext()) { var query = (from x in cl.Venta where (x.Fecha == Convert.ToDateTime(fecha)) select x).ToList(); return(query); } }
public List <Producto> TraerProductos() { using (Clsbdcontext cl = new Clsbdcontext()) { List <Producto> lista = (from x in cl.Producto select x).ToList(); return(lista); } }
//------------------------------------------------------------VENTAS-------------------------------------------------------------------// public void VentasdelDia(int cliente, int producto, DateTime fecha) { using (var contexto = new Clsbdcontext()) { var venta = new Venta() { Cliente = cliente, Producto = producto, Fecha = fecha }; contexto.Venta.Add(venta); contexto.SaveChanges(); } }
//------------------------------------------------------------PRODUCTO-------------------------------------------------------------------// public void insertarProductos(string cod, string mar, string nom, decimal prec) { using (var contexto = new Clsbdcontext()) { var productos = new Producto() { Codigo = cod, Marca = mar, Nombre = nom, Precio = prec }; contexto.Producto.Add(productos); contexto.SaveChanges(); } }
//------------------------------------------------------------CLIENTE-------------------------------------------------------------------// public void insertarCliente(string dni, string nombr, string apellido, string direccion, string telefono) { using (var contexto = new Clsbdcontext()) { var clientes = new Cliente() { Dni = dni, Nombre = nombr, Apellido = apellido, Direccion = direccion, Telefono = telefono }; contexto.Cliente.Add(clientes); contexto.SaveChanges(); } }