public async Task <IActionResult> Edit(int id, [Bind("IDKG,IDPhim,ThoiGian,TrangThai")] KhungGioModel khungGioModel) { if (id != khungGioModel.IDKG) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(khungGioModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!KhungGioModelExists(khungGioModel.IDKG)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IDPhim"] = new SelectList(_context.Phim, "IDPhim", "IDPhim", khungGioModel.IDPhim); return(View(khungGioModel)); }
public async Task <IActionResult> Create([Bind("IDKG,IDPhim,ThoiGian,TrangThai")] KhungGioModel khungGioModel) { if (ModelState.IsValid) { _context.Add(khungGioModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IDPhim"] = new SelectList(_context.Phim, "IDPhim", "IDPhim", khungGioModel.IDPhim); return(View(khungGioModel)); }