public async Task <IActionResult> Edit(int id, [Bind("Id,TenSuatChieu,GiaSuatChieu")] LoaiSuatChieuModel loaiSuatChieuModel) { if (id != loaiSuatChieuModel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(loaiSuatChieuModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LoaiSuatChieuModelExists(loaiSuatChieuModel.Id)) { return(NotFound()); } else { throw; } } } return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Create([Bind("Id,TenSuatChieu,GiaSuatChieu")] LoaiSuatChieuModel loaiSuatChieuModel) { if (ModelState.IsValid) { _context.Add(loaiSuatChieuModel); await _context.SaveChangesAsync(); } return(View("Index")); }
// GET: Admin/LoaiSuatChieu public async Task <IActionResult> Index(int id, String?Key) { LoaiSuatChieuModel mod = null; if (id != null) { mod = _context.LoaiSuatChieu.FirstOrDefault(s => s.Id == id); } ViewBag.List = _context.LoaiSuatChieu.ToList(); if (Key != null) { ViewBag.List = _context.LoaiSuatChieu.Where(s => s.TenSuatChieu.Contains(Key)).ToList(); } return(View(mod)); }