Link to home
Start Free TrialLog in
Avatar of Mani Pazhana
Mani PazhanaFlag for United States of America

asked on

Need help on C# Linq query on object

Hello Experts,
i have the following C# data object:  image attached.



1. I want to write a C# LINQ query to group by Model ID and Sum of Stock QTY

Output Should be :

ModelID               Model                                                                                         TotalStockQty
163041                WHA-024-C-0-3-1-000-00:00-0A-00-00-B0000-00000            3
163042               WHA-009-C-0-3-1-000-00:00-0A-00-00-B0000-00000           17



2. Use the Same Data(Image attached) Next LINQ query  - I want to pass ModelID and get Model details

Output should be:  (for model ID: 163041 )
Model                                                                                                Available Date                        Stock Qty
WHA-024-C-0-3-1-000-00:00-0A-00-00-B0000-00000           1/15/2017 12:00:00 AM                  1
WHA-024-C-0-3-1-000-00:00-0A-00-00-B0000-00000           1/23/2017 12:00:00 AM                  2

(for model ID: 163042 )
WHA-009-C-0-3-1-000-00:00-0A-00-00-B0000-00000          1/29/2017 12:00:00 AM                  7
WHA-009-C-0-3-1-000-00:00-0A-00-00-B0000-00000          2/15/2017 12:00:00 AM                  5
WHA-009-C-0-3-1-000-00:00-0A-00-00-B0000-00000          2/21/2017 12:00:00 AM                  5


Can someone help with LINQ C# query?

Thanks
StockSchedule.JPG
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mani Pazhana

ASKER

Thank you all.
Hi mani_sai;

If any or all of the posted solutions answered the question please close the question by assigning points or if not please post a followup question.
Thanks