Apart from me, there is still no concrete solution to my problem.
I have 2 classes like this:
Public category product {public product () {option = new list & lt; Options & gt; (); } Public string name {get; Set; } Get public int id { Set; } Public listing & lt; Options & gt; Option {get; Set; }} Public Class Option {Public AT Subid {Receipt; Set; } Public string aliases {get; Set; } Public Ink ListBoxID {get; Set; } Public decimal value {received; Set; } Public Bull ISEelected {get; Set; }}
Used in the list:
list & gt; Products & gt; Product {Received; Set; }
When a user selects a product on the left (which always happens with the same properties), this internal list & lt; Optie & gt; <4> will be loaded in 4 different
ListBox
, ListBoxID
.
Now, if a user selects one option in 2 products, how can I use linq in a result?
e.g. 4 similar products are loaded, if the user selects the same option for 2 products, then my result will be:
2x Product 2x LookBraud 2x Olmama 2x Fitness Brodze 2x Teststest
If 2 other products have different selections, then the result may be:
2x Product 2x Ciaabata Brodze 2x Olama 2x Slug 2x Smoos
I always need load volume in product
: Example: If 6 products are loaded, then my combination can be:
3x product 3x Ciabata Brodje 3x olemma 3x slugooms 3x smoss
3x product 3x some other options 1 3x some other options 2 3x some other options 3 3x some other option 4
or
2x product 2x some options 1 2x some options 2 2x some options 3 2x some options 4
2x product 2x some other option 1 2x some other option 2 2x some other option 3 2x some other option 4 < / Code>
2x product 2x some other options 1 2x some other options 2 2x some other option 3 2x some other option 4
This is the best explanation I can give, I hope That helps in the image.
Do you have GroupBy
?. It will group optie
s with a single ID and give you the number of them.
Products Oopsis .GroupBy (x => New {x.ListBoxID, X.Naam}). Select (x = & gt; new {ListBoxID = x.Key.ListBoxID, name = x.Key.Naam, Count = x.Count ()})
Comments
Post a Comment