Guest User

Untitled

a guest
Mar 24th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. public ViewResult Index()
  2. {
  3.  
  4. ProductsListViewModel viewModel = new ProductsListViewModel
  5. {
  6. Products = repository.Products
  7. .Where(p => p.CategoryId == 100)
  8. .OrderByDescending(p=>p.ProductID)
  9. .Take(5)
  10. };
  11. return View(viewModel);
  12. }
  13.  
  14.  
  15. @foreach (var p in Model.Products)
  16. {
  17.  
  18. <a href="">@p.ProductName</a>
  19. }
  20.  
  21.  
  22. public class shop_Products {
  23. public int ProductID { get; set; }
  24. public string ProductName { get; set; }
  25. public int CategoryId { get; set; }
  26. public Nullable<int> CategoryPropertyId { get; set; }
  27. public string PropertyValue { get; set; }
  28. public Nullable<int> ProductBrandId { get; set; }
  29. public Nullable<decimal> MarketPrice { get; set; }
  30. public decimal Price { get; set; }
  31. public Nullable<decimal> UserPrice { get; set; }
  32. public string TitleKeyword { get; set; }
  33. public string MetaKeyword { get; set; }
  34. public string MetaDescription { get; set; }
  35. public string PhotoName { get; set; }
  36. public string PhotoPath { get; set; }
  37. public string smallPhotos { get; set; }
  38. public string BigPhotos { get; set; }
  39. public string URL { get; set; }
  40. public double Discount { get; set; }
  41. public int Inventory { get; set; }
  42. public string ShortDesc { get; set; }
  43. public bool IsAccessories { get; set; }
  44. public bool IsGroup { get; set; }
  45. public bool IsTopService { get; set; }
  46. public string Accessorices { get; set; }
  47. public string PeopleGroup { get; set; }
  48. public string TopService { get; set; }
  49. public string Contents { get; set; }
  50. public string Parameter { get; set; }
  51. public string PackingList { get; set; }
  52. public string Service { get; set; }
  53. public string Professional { get; set; }
  54. public bool IsParameter { get; set; }
  55. public bool IsPackingList { get; set; }
  56. public bool IsService { get; set; }
  57. public bool IsProfessional { get; set; }
  58. public Nullable<bool> IsEnable { get; set; }
  59. public Nullable<bool> IsCommend { get; set; }
  60. public Nullable<bool> IsTop { get; set; }
  61. public Nullable<bool> IsBest { get; set; }
  62. public string ProductBrandType { get; set; }
  63. public string Manufacturer { get; set; }
  64. public string Makein { get; set; }
  65. public string weight { get; set; }
  66. public System.DateTime InputTime { get; set; }
  67. public Nullable<int> Sort { get; set; }
  68. public Nullable<int> SeeCount { get; set; }
  69. }
  70.  
  71. [Key]
  72. public int ProductID { get; set; }
  73.  
  74. public int id {get; set;}
  75.  
  76. [Key] public int ProductID { get; set; }
Add Comment
Please, Sign In to add comment