I have a model that includes a data type list property of another model, as shown below.
public class Eatables { int id {get;set;} string name{get;set;} List<Ingredient> ingredientList{get;set;} } public class Ingredient { int id {get;set;} quantity {get;set;} calories {get;set;} }
if I want to display a list of edible things with their ingredient required according to the kendo header below.
SL.No | Eatable | Sugar(KG) | Salt(gram) | Oil(L)
I am passing a list of edible items that are consumed when the kendo list is displayed if the sugar ingredient identifier is 2 and the salt ingredient identifier is 4. I came across a LINQ query below to get the amount of ingredient, as shown below.
columns.Bound(x => x.ingredientList.Find(x=>x.id=="2").quantity) -- to fetch sugar quantity columns.Bound(x => x.ingredientList.Find(x=>x.id=="4").quantity) -- to fetch salt quantity
But the above queries do not extract the quantity, although the values ββare available in the model sent from the controller. please suggest, if I am missing a request, it was the day Iβm in the maze to fix the problem.
source share