public ActionResult Create([Bind(Include = "ID,Name,Email")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customers.Add(customer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }
Пример #2
0
        public ActionResult Create([Bind(Include = "ID,Manufacturer,Model,EnginePower")] Car car)
        {
            if (ModelState.IsValid)
            {
                db.Cars.Add(car);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(car));
        }
Пример #3
0
        public ActionResult Create([Bind(Include = "ID,CarID,CustomerID,SalePrice,PurchasedOn")] Order order)
        {
            if (ModelState.IsValid)
            {
                db.Orders.Add(order);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CarID      = new SelectList(db.Cars, "ID", "Manufacturer", order.CarID);
            ViewBag.CustomerID = new SelectList(db.Customers, "ID", "Name", order.CustomerID);
            return(View(order));
        }
Пример #4
0
        private void RunDataInitialization(ShowRoomContext context)
        {
            if (!context.Account.Any())
            {
                context.Account.Add(new Models.Account()
                {
                    FullName        = "Admin",
                    Email           = "*****@*****.**",
                    Password        = "******",
                    ConfirmPassword = "******",
                    Gender          = "Male",
                    Type            = Models.userType.Admin,
                });

                context.Account.Add(new Models.Account()
                {
                    FullName        = "Bdika",
                    Email           = "*****@*****.**",
                    Password        = "******",
                    ConfirmPassword = "******",
                    Gender          = "Male",
                    Type            = Models.userType.Customer,
                });
            }

            if (!context.Clothings.Any())
            {
                context.Clothings.AddRange(new List <Models.Clothings>()
                {
                    new Models.Clothings()
                    {
                        Brand       = "Zara",
                        Category    = "1",
                        Description = "A very beautiful and durable T-shirt created from recycable materials. Vegan Friendly.",
                        ImageUrl    = @"images\Clothes\shirt.jpeg",
                        Name        = "SS20 Women Fashion Awards Show T-Shirt",
                        Price       = 169.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Balenciaga",
                        Category    = "5",
                        Description = "Premium Leather Unisex Handbag",
                        ImageUrl    = @"images\Clothes\accessories.jpeg",
                        Name        = "SS21 SSENSE BALENCIAGA SHOW",
                        Price       = 2390.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Heron Preston",
                        Category    = "2",
                        Description = "Heron Preston x AAPE Collab SS20",
                        ImageUrl    = @"images\Clothes\pants.jpeg",
                        Name        = "Heron Preston x AAPE SS20 Shorts",
                        Price       = 1490.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Yeezy",
                        Category    = "3",
                        Description = "This inaugural colorway of Kanye West’s Yeezy Wave Runner 700 launched in November 2017.",
                        ImageUrl    = @"images\Clothes\shoes.jpg",
                        Name        = "Yeezy Boost 700 V1 Waverunner",
                        Price       = 1299.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Asos",
                        Category    = "4",
                        Description = "Basic dress.",
                        ImageUrl    = @"images\Clothes\dress.jpeg",
                        Name        = "Basic Essential Black Dress by Asos. SS19",
                        Price       = 219.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Zara",
                        Category    = "2",
                        Description = "Basic Men Jeans.",
                        ImageUrl    = @"images\Clothes\Men\10.jpeg",
                        Name        = "Basic Jeans by Zara. SS19",
                        Price       = 219.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Asos",
                        Category    = "1",
                        Description = "Basic Men T-Shirt.",
                        ImageUrl    = @"images\Clothes\Men\2.jpeg",
                        Name        = "Basic Men T-Shirt by Asos. SS19",
                        Price       = 189.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Asos",
                        Category    = "1",
                        Description = "Basic Men Brown Jacket.",
                        ImageUrl    = @"images\Clothes\Men\1.jpeg",
                        Name        = "Basic Men Brown Jacket by Asos. SS19",
                        Price       = 169.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Asos",
                        Category    = "2",
                        Description = "Basic Men Jeans.",
                        ImageUrl    = @"images\Clothes\Men\11.jpeg",
                        Name        = "Basic Men Jeans by Asos. SS19",
                        Price       = 170.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Zara",
                        Category    = "1",
                        Description = "Black Coat For Men.",
                        ImageUrl    = @"images\Clothes\Men\13.jpeg",
                        Name        = "Basic Black Coat For Men. SS19",
                        Price       = 159.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Zara",
                        Category    = "1",
                        Description = "Black Jeans Jacket.",
                        ImageUrl    = @"images\Clothes\Men\12.jpeg",
                        Name        = "Black Jeans Jacket By Zara. SS19",
                        Price       = 149.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Asos",
                        Category    = "1",
                        Description = "Red Coat For Men.",
                        ImageUrl    = @"images\Clothes\Men\14.jpeg",
                        Name        = "Red Coat For Men by Asos. SS19",
                        Price       = 245.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Asos",
                        Category    = "1",
                        Description = "Basic Loose Black Coat.",
                        ImageUrl    = @"images\Clothes\Men\15.jpeg",
                        Name        = "Basic Black Coat by Asos. SS19",
                        Price       = 210.00
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Bershka",
                        Category    = "1",
                        Description = "Basic Men White T-Shirt.",
                        ImageUrl    = @"images\Clothes\Men\3.jpeg",
                        Name        = "Basic Men T-Shirt by Bershka. SS19",
                        Price       = 69.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Asos",
                        Category    = "1",
                        Description = "Basic Men Two-tone Hoodie.",
                        ImageUrl    = @"images\Clothes\Men\4.jpeg",
                        Name        = "Basic Men Two-tone Hoodie by Asos. SS19",
                        Price       = 129.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Asos",
                        Category    = "1",
                        Description = "Basic Men Hoodie.",
                        ImageUrl    = @"images\Clothes\Men\5.jpeg",
                        Name        = "Basic Men Hoodie by Asos. SS19",
                        Price       = 129.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Zara",
                        Category    = "2",
                        Description = "Basic Men Pink Pants.",
                        ImageUrl    = @"images\Clothes\Men\6.jpeg",
                        Name        = "Basic Men Pink Pants by Zara. SS19",
                        Price       = 79.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Asos",
                        Category    = "1",
                        Description = "Blue Coat For Men.",
                        ImageUrl    = @"images\Clothes\Men\7.jpeg",
                        Name        = "Blue Coat For Men by Asos. SS19",
                        Price       = 169.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Bershka",
                        Category    = "2",
                        Description = "Blue Jeans For Men.",
                        ImageUrl    = @"images\Clothes\Men\8.jpeg",
                        Name        = "Blue Jeans For Men By Bershka. SS19",
                        Price       = 210.00
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Asos",
                        Category    = "2",
                        Description = "Basic Men Jeans.",
                        ImageUrl    = @"images\Clothes\Men\9.jpeg",
                        Name        = "Basic Men Jeans by Asos. SS19",
                        Price       = 179.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Nike",
                        Category    = "3",
                        Description = "UniSex Nike Shoes.",
                        ImageUrl    = @"images\Clothes\Men\Shoe1.jpeg",
                        Name        = "UniSex Nike Shoes by Nike. SS19",
                        Price       = 330.90
                    },
                    new Models.Clothings()
                    {
                        Brand       = "Asos",
                        Category    = "3",
                        Description = "Shoes For Men.",
                        ImageUrl    = @"images\Clothes\Men\Shoe2.jpeg",
                        Name        = "Shoes For Men by Asos. SS19",
                        Price       = 270.90
                    },
                    // new Models.Clothings()
                    //{
                    //    Brand = "Asos",
                    //    Category = "3",
                    //    Description = "Unisex Shoes.",
                    //    ImageUrl = @"images\Clothes\Men\Shoe3.jpeg",
                    //    Name = "White Green Shoes by Asos. SS19",
                    //    Price = 229.90
                    //},
                    new Models.Clothings()
                    {
                        Brand       = "Asos",
                        Category    = "4",
                        Description = "Black Dress.",
                        ImageUrl    = @"images\Clothes\Women\1.jpeg",
                        Name        = "Black Dress For Women by Asos. SS19",
                        Price       = 59.90
                    },
                });
            }

            context.SaveChanges();
        }