i have three objects i need to take from database and combine all three to one list object when an if statement take place what i have for now is a code return only one object
List<ITEMS1> ITEM1 = db.ITEMS1.ToList();
ITEMS2 ITEM2 = db.ITEMS2;
ITEMS3 ITEM3 = db.ITEMS3;
ITM_Table itm_tab = new ITM_Table();
foreach (var item in ITEMS1)
{ if (ITEMS1.CODE== 999)
{
itm_tab.ITEM_CODE = ITEMS1.ITEM_CODE;
itm_tab.ITEM_NAME = ITEMS1.ITEM_NAME;
itm_tab.ITEM_BCODE = ITEMS1.ITEM_BCODE;
itm_tab.ITEM_CUSTNOW = ITEM2 .ITEM_CUSTNOW;
itm_tab.ITEM_BALANCE = ITEM2 .ITEM_BALANCE;
itm_tab.QTY_MIN = ITEM3 .QTY_MIN;
itm_tab.QTY_R = ITEM3 .QTY_R;
}
return itm_tab;
how i can combine every object in the list object with the two other objects and return new list object of the all objects I want the return result to look like this
[
{"ITEM_CODE ":999,"ITEM_NAME ":"new store","ITEM_BCODE":"M00001","ITEM_CUSTNOW ":"first","ITEM_BALANCE":900.00,"QTY_MIN":100.0,"QTY_R":100.0},
{"ITEM_CODE ":999,"ITEM_NAME ":"new store2","ITEM_BCODE":"M00002","ITEM_CUSTNOW ":"second","ITEM_BALANCE":800.00,"QTY_MIN":30.0,"QTY_R":00.0},
{"ITEM_CODE ":999,"ITEM_NAME ":"new store3","ITEM_BCODE":"M00005","ITEM_CUSTNOW ":"th3","ITEM_BALANCE":40.00,"QTY_MIN":100.0,"QTY_R":100.0},
]
the value of "ITEM_CUSTNOW "&"QTY_MIN "&"QTY_MIN "&"QTY_R " should Depends on the value of "ITEM_NAME "
Aucun commentaire:
Enregistrer un commentaire