Exemplo n.º 1
0
        public IActionResult Create(string newName, string newCost, string newCountry, string newImage)
        {
            Gummy newGummy = new Gummy(newName, newCost, newCountry, newImage);

            db.Gummies.Add(newGummy);
            db.SaveChanges();
            return(Json(newGummy));
        }
Exemplo n.º 2
0
        private static void AddTestData(GummiesContext context)
        {
            var autoGummy1 = new Models.Gummy
            {
                Name    = "Pale Ale Pints",
                Cost    = "3",
                Country = "Germany",
                Image   = "https://www.sugarfina.com/shop/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/P/0/P0132.jpg"
            };

            context.Gummies.Add(autoGummy1);

            var autoGummy2 = new Models.Gummy
            {
                Name    = "Parisian Pineapples",
                Cost    = "8",
                Country = "France",
                Image   = "https://www.sugarfina.com/shop/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/p/a/parisian-pineapples.jpg"
            };

            context.Gummies.Add(autoGummy2);

            var autoGummy3 = new Models.Gummy
            {
                Name    = "Ice Cream Cones",
                Cost    = "3",
                Country = "Germany",
                Image   = "https://www.sugarfina.com/shop/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/P/0/P0099.jpg"
            };

            context.Gummies.Add(autoGummy3);

            var autoGummy8 = new Models.Gummy
            {
                Name    = "Watermelon Slices",
                Cost    = "8",
                Country = "Germany",
                Image   = "https://www.sugarfina.com/shop/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/w/a/watermelon_slices.jpeg"
            };

            context.Gummies.Add(autoGummy8);

            var autoGummy4 = new Models.Gummy
            {
                Name    = "Roses",
                Cost    = "9",
                Country = "Germany",
                Image   = "https://www.sugarfina.com/shop/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/b/u/but_first_rose_bowl_72dpi.jpg"
            };

            context.Gummies.Add(autoGummy4);

            var autoGummy5 = new Models.Gummy
            {
                Name    = "Beach Buddies",
                Cost    = "4",
                Country = "Germany",
                Image   = "https://www.sugarfina.com/shop/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/P/0/P0015.jpg"
            };

            context.Gummies.Add(autoGummy5);

            var autoGummy6 = new Models.Gummy
            {
                Name    = "Wild Strawberry Fruttini",
                Cost    = "9",
                Country = "Italy",
                Image   = "https://www.sugarfina.com/shop/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/P/0/P0177.jpg"
            };

            context.Gummies.Add(autoGummy6);

            var autoGummy7 = new Models.Gummy
            {
                Name    = "Gummy Kicks",
                Cost    = "8",
                Country = "Germany",
                Image   = "https://www.sugarfina.com/shop/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/P/0/P0089.jpg"
            };

            context.Gummies.Add(autoGummy7);

            context.SaveChanges();
        }