예제 #1
0
        public ActionResult Create([Bind(Include = "CustomerId,Firstname,Lastname,Adress,Zip,City")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customer.Add(customer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "SizeId,Name")] Size size)
        {
            if (ModelState.IsValid)
            {
                db.Size.Add(size);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(size));
        }
예제 #3
0
        public ActionResult Create([Bind(Include = "ProductId,Name,Price,Image,Description,Specs,SizeId")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Product.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.SizeId = new SelectList(db.Size, "SizeId", "Name", product.SizeId);
            return(View(product));
        }