Example #1
0
        public ActionResult Create([Bind(Include = "ID,UserName,Balance")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(user));
        }
Example #2
0
        public ActionResult Create([Bind(Include = "ID,DeliveredOn,OrderOn,Value")] Order order)
        {
            if (ModelState.IsValid)
            {
                db.Orders.Add(order);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(order));
        }
Example #3
0
        public ActionResult Create([Bind(Include = "ID,Name,Cost,Class,ImageURL")] ShopItem shopItem)
        {
            if (ModelState.IsValid)
            {
                db.ShopItems.Add(shopItem);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(shopItem));
        }
Example #4
0
 public void Save()
 {
     context.SaveChanges();
 }