Exemple #1
0
        public static void Initital(AppDBContent content)
        {
            if (!content.Category.Any())
            {
                content.Category.AddRange(Categories.Select(c => c.Value));
            }

            if (!content.Dish.Any())
            {
                content.AddRange(
                    new Dish
                {
                    name      = "Pizza",
                    shortDesc = "E",
                    longDesc  = "EEE",
                    img       = "image",
                    price     = 2300,
                    Category  = Categories["Hot meals"]
                },

                    new Dish
                {
                    name      = "Dorritos",
                    shortDesc = "E",
                    longDesc  = "EEE",
                    img       = "image",
                    price     = 1200,
                    Category  = Categories["Snacks"]
                },

                    new Dish
                {
                    name      = "Black tea",
                    shortDesc = "E",
                    longDesc  = "EEE",
                    img       = "image",
                    price     = 900,
                    Category  = Categories["Drinks"]
                },

                    new Dish
                {
                    name      = "Icecream",
                    shortDesc = "E",
                    longDesc  = "EEE",
                    img       = "image",
                    price     = 1500,
                    Category  = Categories["Desserts"]
                }



                    );
            }

            content.SaveChanges();
        }
Exemple #2
0
        public void Initial(AppDBContent context)
        {
            if (!context.Categories.Any())
            {
                context.Categories.AddRange(Categories.Select(c => c.Value));
            }
            if (!context.Sites.Any())
            {
                context.AddRange
                (
                    new Site
                {
                    Name        = "Youtube",
                    UrlMainPage = "https://www.youtube.com/",
                    Category    = Categories["Other"]
                },
                    new Site
                {
                    Name        = "Google",
                    UrlMainPage = "https://www.google.com/",
                    Category    = Categories["Other"]
                },
                    new Site
                {
                    Name        = "Unian",
                    UrlMainPage = "https://www.unian.ua/",
                    Category    = Categories["News"]
                },
                    new Site
                {
                    Name        = "Правда",
                    UrlMainPage = "https://www.pravda.com.ua/news/",
                    Category    = Categories["News"]
                },
                    new Site
                {
                    Name        = "спорт",
                    UrlMainPage = "https://sport.ua/uk",
                    Category    = Categories["Sport"]
                },
                    new Site
                {
                    Name        = "УкрНет",
                    UrlMainPage = "https://www.ukr.net/news/sport.html",
                    Category    = Categories["Sport"]
                }
                );
            }

            context.SaveChanges();
        }