Пример #1
0
        public ActionResult Create(Restaurant restaurant)
        {
            if (ModelState.IsValid)
            {
                _db.Add(restaurant);
                _db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(restaurant));
        }
Пример #2
0
        public ActionResult Create([Bind(Include = "Id,Name,City,Country")] Restaurant restaurant)
        {
            if (ModelState.IsValid)
            {
                _db.Add(restaurant);
                _db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(restaurant));
        }