Beispiel #1
0
    public async void populateSections()
    {
        if (await Sections.AnyAsync())
        {
            return;             // DB has been seeded
        }

        var sections = new List <Section>()
        {
            new Section {
                Name = "Gaming", Image = "gaming.png", description = "Talk about any game"
            },
            new Section {
                Name = "News", Image = "news.png", description = "Post news here and share your views on them!"
            },
            new Section {
                Name = "Software", Image = "wrench.png", description = "Discuess software here!"
            },
            new Section {
                Name = "Hardware", Image = "cogs.png", description = "Post about anything hardware"
            },
            new Section {
                Name = "Nature", Image = "nature.png", description = "Post beutriful pictures of nature and talk about locations you would like to visit"
            },
            new Section {
                Name = "Craftmanship", Image = "crafting.png", description = "How off your creations and build projects here, or ask for advice"
            },
            new Section {
                Name = "Art", Image = "art.png", description = "Drawings, textures or similar can be shared here and discuessed here!"
            },
            new Section {
                Name = "Music", Image = "music.png", description = "Talk about music, or share your own"
            },
            new Section {
                Name = "Books", Image = "books.png", description = "Share your thoughts about books you've read, or are writing"
            },
            new Section {
                Name = "Off-topic", Image = "offtopic.png", description = "Talk about anything random here"
            }
        };

        sections.Add(new Section {
            Name = "World of Warcraft", Image = "wow.png", description = "", parent = sections[0]
        });
        sections.Add(new Section {
            Name = "Diablo 3", Image = "diablo.png", description = "", parent = sections[0]
        });
        sections.Add(new Section {
            Name = "Overwatch", Image = "ow.png", description = "", parent = sections[0]
        });

        Sections.AddRange(sections);
        SaveChanges();
    }