Ejemplo n.º 1
0
        public async Task AddDictionaryToSection(Guid dictionaryId, Guid sectionId)
        {
            var item = new SectionDictionary()
            {
                DictionaryId = dictionaryId,
                SectionId    = sectionId
            };

            await _context.SectionDictionaries.AddAsync(item);
        }
Ejemplo n.º 2
0
        public async Task AddDictionaryToSection(Dictionary dictionary, Section section)
        {
            var item = new SectionDictionary()
            {
                DictionaryId = dictionary.Id,
                SectionId    = section.Id
            };

            await _context.SectionDictionaries.AddAsync(item);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Registers a code block in a dynamic section.
        /// </summary>
        /// <param name="httpContext">HttpContext instance.</param>
        /// <param name="dynamicSectionName">Name of the dynamic section where this block will be registered.</param>
        /// <param name="key">Key name. If it exists, the previous block will be overwritten.</param>
        /// <param name="content">Content to be registered.</param>
        public static void RegisterBlock(this HttpContext httpContext,
                                         string dynamicSectionName, string key, string content)
        {
            var sections = (SectionDictionary)httpContext.Items[HttpContextItemName];

            if (sections == null)
            {
                sections = new SectionDictionary();
                httpContext.Items[HttpContextItemName] = sections;
            }
            dynamicSectionName = dynamicSectionName ?? string.Empty;
            key = key ?? string.Empty;
            if (!sections.ContainsKey(dynamicSectionName))
            {
                sections[dynamicSectionName] = new BlockDictionary();
            }
            sections[dynamicSectionName][key] = content;
        }
Ejemplo n.º 4
0
        private static string GetSectionAndRemoveWhenRequested(SectionDictionary sections,
                                                               bool remove, params string[] sectionNames)
        {
            var sb = new StringBuilder();

            foreach (var sectionName in sectionNames)
            {
                var contents = sections[sectionName].Select(c => c.Value);
                foreach (var content in contents)
                {
                    sb.Append(content);
                }

                if (remove) // This section can be obtained only once!
                {
                    sections.Remove(sectionName);
                }
            }
            return(sb.ToString());
        }
Ejemplo n.º 5
0
 internal AudioStream(SectionDictionary values) : base(values)
 {
 }
Ejemplo n.º 6
0
 internal GeneralStream(SectionDictionary values) : base(values)
 {
 }
Ejemplo n.º 7
0
 internal VideoStream(SectionDictionary values) : base(values)
 {
 }