Beispiel #1
0
        public ActionResult Create([Bind(Include = "ProducerId,Name")] Producer producer)
        {
            if (ModelState.IsValid)
            {
                fe.Producers.Add(producer);
                fe.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(producer));
        }
Beispiel #2
0
        public ActionResult Create([Bind(Include = "CategoryId,Name,Description")] Category category)
        {
            if (ModelState.IsValid)
            {
                fe.Categories.Add(category);
                fe.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
Beispiel #3
0
        public ActionResult Create([Bind(Include = "ItemId,CategoryId,ProduceId,Title,Price,ItemArtUrl")] Item item)
        {
            if (ModelState.IsValid)
            {
                fe.Items.Add(item);
                fe.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CategoryId = new SelectList(fe.Categories, "CategoryId", "Name", item.CategoryId);
            ViewBag.ProduceId  = new SelectList(fe.Producers, "ProducerId", "Name", item.ProduceId);
            return(View(item));
        }
Beispiel #4
0
        public ActionResult Register(User user)
        {
            if (ModelState.IsValid)
            {
                using (FourSeasonsEntities fe = new FourSeasonsEntities())
                {
                    fe.Users.Add(user);
                    fe.SaveChanges();
                }
                ModelState.Clear();
                ViewBag.Message = user.FirstName + " " + user.LastName + " succesfully registered.";
            }

            return(View());
        }