Пример #1
0
        private async Task <List <ContentSectionItem> > ToContentSectionItems(string sectionItems)
        {
            List <ContentSectionItem> output = new List <ContentSectionItem>();

            if (!string.IsNullOrEmpty(sectionItems))
            {
                var sections = sectionItems.Split(SECTION_DELIM);
                for (int i = 0; i < sections.Count(); i++)
                {
                    var sectionFields     = sections[i].Split(TYPE_DELIM);
                    var section           = sectionFields[0];
                    var sectionItemString = sectionFields[1];

                    var segments = sectionItemString.Split(SEGMENT_DELIM);

                    var pathUrl = string.Empty;
                    for (int j = 0; j < segments.Count() - 1; j++)
                    {
                        if (!string.IsNullOrEmpty(pathUrl))
                        {
                            pathUrl += SEGMENT_DELIM;
                        }
                        pathUrl += segments[j];
                    }
                    var alias = segments[segments.Count() - 1];

                    var sectionItem = await(from si in _dbContext.SectionItems
                                            where si.Section == section &&
                                            si.PathUrl == pathUrl &&
                                            si.Alias == alias
                                            select si).ToListAsync();

                    ContentSectionItem contentSectionItem = new ContentSectionItem();

                    if (sectionItem.Count() > 0)
                    {
                        contentSectionItem.Id          = Guid.NewGuid().ToString();
                        contentSectionItem.SectionItem = sectionItem.First();
                        output.Add(contentSectionItem);
                    }
                }
            }

            return(output);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     Model = new SublayoutParamHelper(this, false).DataSourceItem;
 }