Beispiel #1
0
        public static Element ElementFromDatabase(DbTagsAndAttributes tagsAndAttributes)
        {
            var rootElementQuery =
                from tag in tagsAndAttributes.Tags
                where tag.ParentId is null
                select tag;

            var rootTag = rootElementQuery.First();

            // database contains no root element or is empty
            if (rootTag is null)
            {
                return(new Element());
            }

            var helper = new HelperDbTagsAndAttributes(tagsAndAttributes);

            return(helper.ElementFromDatabaseTag(rootTag));
        }
Beispiel #2
0
 public HelperDbTagsAndAttributes(DbTagsAndAttributes tagsAndAttributes)
 {
     TagsAndAttributes = tagsAndAttributes;
 }
Beispiel #3
0
 public void UpdateTagsAndAttributes(DbTagsAndAttributes tagsAndAttributes)
 {
     UpdateTags(tagsAndAttributes.Tags);
     UpdateAttributes(tagsAndAttributes.Attributes);
 }