public ActionResult Create(Film film) { if (ModelState.IsValid) { film.bDelete = false; db.Films.Add(film); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.Loai = new SelectList(db.Loais, "ID", "TenLoai", film.Loai); return View(film); }
public ActionResult Edit(Film film) { if (ModelState.IsValid) { film.bDelete = false; db.Entry(film).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.Loai = new SelectList(db.Loais, "ID", "TenLoai", film.Loai); return View(film); }