public List <PRODUCTO> Ordenado() // retorna objetos { var productos = new List <PRODUCTO>(); string txtresultado = ""; try { /******ORIGEN DE DATOS*******/ using (var db = new ModeloVentas()) { //Sentencia LINQ productos = db.PRODUCTO .Include("CATEGORIA") .OrderByDescending(x => x.NOMBRE) .ToList(); } /***************************/ } catch (Exception e) { throw; } return(productos); }
public List <PRODUCTO> BuscarProductoPorCategoria(string buscar) // retorna objetos { var productos = new List <PRODUCTO>(); try { /******ORIGEN DE DATOS*******/ using (var db = new ModeloVentas()) { //Sentencia LINQ productos = db.PRODUCTO .Include("CATEGORIA") .Where(x => x.NOMBRE.Contains(buscar) || x.CATEGORIA.NOMBRE.Contains(buscar)) .ToList(); } /***************************/ } catch (Exception e) { throw; } return(productos); }
/************************** METODOS *************************/ public List <CATEGORIA> Listar() // retorna objetos { var categorias = new List <CATEGORIA>(); try { /******ORIGEN DE DATOS*******/ using (var db = new ModeloVentas()) { //Sentencia LINQ categorias = db.CATEGORIA.ToList(); } /***************************/ } catch (Exception e) { throw; } return(categorias); }
public List <PRODUCTO> ConsultaWhere() // retorna objetos { var productos = new List <PRODUCTO>(); try { /******ORIGEN DE DATOS*******/ using (var db = new ModeloVentas()) { //Sentencia LINQ productos = db.PRODUCTO .Where(x => x.NOMBRE.StartsWith("m")) .ToList(); } /***************************/ } catch (Exception e) { throw; } return(productos); }
/************************** METODOS *************************/ public List <PRODUCTO> Listar() // retorna objetos { var productos = new List <PRODUCTO>(); try { /******ORIGEN DE DATOS*******/ using (var db = new ModeloVentas()) { //Sentencia LINQ productos = db.PRODUCTO .Include("CATEGORIA") .ToList(); } /***************************/ } catch (Exception e) { throw; } return(productos); }
public List <CATEGORIA> ConsultaWhere() // retorna objetos { var categorias = new List <CATEGORIA>(); try { /******ORIGEN DE DATOS*******/ using (var db = new ModeloVentas()) { //Sentencia LINQ categorias = db.CATEGORIA .Where(x => x.NOMBRE.StartsWith("T")) .ToList(); } /***************************/ } catch (Exception e) { throw; } return(categorias); }
public List <PRODUCTO> ConsultaWhere2() // retorna objetos { var productos = new List <PRODUCTO>(); try { /******ORIGEN DE DATOS*******/ using (var db = new ModeloVentas()) { //Sentencia LINQ productos = db.PRODUCTO .Include("CATEGORIA") .Where(x => x.NOMBRE.Contains("m") && x.PRECIO <= 600) .ToList(); } /***************************/ } catch (Exception e) { throw; } return(productos); }