.clasu
11/09/2023, 11:02 AMrickbutterfield
11/09/2023, 11:04 AMModel
in this context is an Enumerable
type under the hood so you can do something like if (Model != null)
or if (Model.Any())
.clasu
11/09/2023, 11:17 AMrickbutterfield
11/09/2023, 2:10 PMModel.Areas
or Model.Blocks
.clasu
11/13/2023, 1:56 PMAaron Sawyer
11/14/2023, 1:46 AMAmbert
11/14/2023, 8:10 AMModel.NotNullAndHasAny()
or something 😛Mike Chambers
11/14/2023, 4:05 PMif (Model?.Areas.Any() != true) { return; }
for an early exit..
Which I think, if memory serves, also covers Areas without a Block too? 🤔
Or if (Model?.Areas.Any(x=>x.Any()) != true) { return; }
?? (for if you allow layouts in areas too)?
To get an actual block in an area had to use..
var x = item.Areas.FirstOrDefault(x => x.Any(y => y.Content.ContentType.Alias == GridShowMore.ModelTypeAlias));