c# - asp.net MVC how to show chlid count of model -


i have model named productgroup , want show count of child product group in view .

enter image description here

that's pretty simple linq query:

var productchildcounts = context.productgroups                 .include(pg => pg.products)                 .include(pg => pg.attributes)                 .select(pg => new                 {                     pg.title,                     productcount = pg.products.count(),                     attributecount = pg.attributes.count()                 }); 

http://www.dotnetcurry.com/showarticle.aspx?id=513


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -