public static MyRequestContext AppendPageInfos(this MyRequestContext context, ViewContext viewContext) { var theGroup = context.GetOrCreate(context.GetGroupName_PageInfos()); var myPageInfo = viewContext.CreateMyPageInfo(); theGroup.Items[viewContext.View.Path] = myPageInfo.ToJson(false); return(context); }
public static IList <MyPageInfo> GetPageInfos(this MyRequestContext context) { var myPageInfos = new List <MyPageInfo>(); var theGroup = context.GetOrCreate(context.GetGroupName_PageInfos(), false); if (theGroup == null) { return(myPageInfos); } var jsonList = theGroup.Items.Values.ToList(); return(jsonList.Select(x => x.FromJson <MyPageInfo>(null)).Where(x => x != null).ToList()); }