public async Task <ActionResult> Create([Bind(Include = "ID,Name,Address")] Store store)
        {
            if (ModelState.IsValid)
            {
                db.Store.Add(store);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(store));
        }
Exemple #2
0
        public async Task <ActionResult> Create([Bind(Include = "ID,Name,Price")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Product.Add(product);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(product));
        }