Пример #1
0
        public ActionResult Create(Art art)
        {
            if (ModelState.IsValid)
            {
                db.Arts.Add(art);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.AuthorID = new SelectList(db.Authors, "AuthorID", "FirstName", art.AuthorID);
            return View(art);
        }
Пример #2
0
 public ActionResult Edit(Art art)
 {
     if (ModelState.IsValid)
     {
         db.Entry(art).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.AuthorID = new SelectList(db.Authors, "AuthorID", "FirstName", art.AuthorID);
     return View(art);
 }