@{ Layout = null; bool CanSeeLevel(PenaltyInfo penalty) => (ViewBag.PermissionsSet as IEnumerable).HasPermission(WebfrontEntity.ClientLevel, WebfrontPermission.Read) || penalty.PenaltyType == EFPenalty.PenaltyType.Report; } @using WebfrontCore.Permissions @using SharedLibraryCore.Dtos @using Data.Models @model IList @{ foreach (var penalty in Model.Where(CanSeeLevel)) { await Html.RenderPartialAsync("_Penalty", penalty); } }