Ramesh p

Ramesh p

  • NA
  • 27
  • 802

How to get products from list based on quantity and max

Oct 21 2019 1:01 AM
Hi,
 
I have list like List<promoptionproducts>.This list contains the objects.
 
PromoptionProducts
  1. Public Class PromotionProducts  
  2. {  
  3. Public long int  
  4.   
  5. Public long ProductId{get;set;}  
  6.   
  7. public long qty{get;set;}  
  8.   
  9. public decimal price{get;set;}  
  10.   
  11. Public int max {get;set;}  
  12. }  
Case1:
  1. List<PromoptionProducts> promotionproduct=new List<PromoptionProducts>(new promotionproduct({Id=1,productId=101,qty=4,price=25,max=3 });  
I want to get the qty of products from list based on max that means I want 3qtyproducts from the list based on 3.
  1. List<PromoptionProducts> promotionproduct=new List<PromoptionProducts>(new promotionproduct({Id=1,productId=101,qty=2,price=25,max=3 },new promotionproduct({Id=2,productId=102,qty=2,price=35,max=3 });  
I want to get the qty of products from list based on max that means I want 3 qty products from the list based on 3.
While using linq queries.
 
Please help me.
Thank you.

Answers (2)