Esempio n. 1
0
        public ActionResult Create([Bind(Include = "ProductID,Name,Description,Price,PictureLink")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(product));
        }
Esempio n. 2
0
        public ActionResult Create([Bind(Include = "UserID,EMail,Password,TelNr,SessionID,IsAdmin")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(user));
        }
Esempio n. 3
0
        public ActionResult Create([Bind(Include = "OrderID,UserID,Paid,OrderDate")] Order order)
        {
            if (ModelState.IsValid)
            {
                db.Orders.Add(order);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.UserID = new SelectList(db.Users, "UserID", "EMail", order.UserID);
            return(View(order));
        }
Esempio n. 4
0
        public ActionResult Register([Bind(Include = "EMail,Password,TelNr")] User user)
        {
            if (ModelState.IsValid)
            {
                var User = new User
                {
                    UserID   = user.UserID,
                    EMail    = user.EMail,
                    Password = user.Password,
                    TelNr    = user.TelNr
                };

                db.Users.Add(User);
                db.SaveChanges();
                CreateCookie(User);
                return(RedirectToAction("Account"));
            }
            return(View(user));
        }