public ActionResult Create(Movy movy) { if (ModelState.IsValid) { db.Movies.Add(movy); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.LeadingMaelRole = new SelectList(db.Actiors, "Id", "Name", movy.LeadingMaelRole); ViewBag.LeadeingFemaleRole = new SelectList(db.Actiors, "Id", "Name", movy.LeadeingFemaleRole); ViewBag.StudioId = new SelectList(db.Studios, "Id", "Name", movy.StudioId); return View(movy); }
public ActionResult Edit(Movy movy) { if (ModelState.IsValid) { db.Entry(movy).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.LeadingMaelRole = new SelectList(db.Actiors, "Id", "Name", movy.LeadingMaelRole); ViewBag.LeadeingFemaleRole = new SelectList(db.Actiors, "Id", "Name", movy.LeadeingFemaleRole); ViewBag.StudioId = new SelectList(db.Studios, "Id", "Name", movy.StudioId); return PartialView("_GetEditForm", movy); }