Advertisement
Guest User

Untitled

a guest
May 24th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. public class Proveedor
  2. {
  3. public int ProveedorId { get; set; }
  4. public string RazonSocial { get; set; }
  5. public string DocumentoIdentidad { get; set; }
  6. public string Direccion { get; set; }
  7. public string Fijo { get; set; }
  8. public string Celular { get; set; }
  9. public string Representante { get; set; }
  10. public string Email { get; set; }
  11.  
  12. public virtual ICollection<Producto> Productos { get; set; }
  13. public virtual ICollection<Marca> Marcas { get; set; }
  14. }
  15.  
  16. public class ProveedorExtend
  17. {
  18. public int Id { get; set; }
  19. public string Descripcion { get; set; }
  20. }
  21.  
  22. public IEnumerable<ProveedorExtend> SelectList(int? codigo, string nombre)
  23. {
  24. var result = (from p in Context.Proveedores
  25. select new ProveedorExtend()
  26. {
  27. Id = p.ProveedorId,
  28. Descripcion = p.RazonSocial
  29. })
  30.  
  31. where ((!codigo.HasValue) || (p.Codigo.Contains(codigo.Value)))
  32. && ((nombre == null) || (p.Nombre.Contains(nombre)))
  33. select p).ToList();;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement