public async Task <IActionResult> Edit(int id, [Bind("IDLTK,TenLTK,TrangThai")] LoaiTKModel loaiTKModel) { if (id != loaiTKModel.IDLTK) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(loaiTKModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LoaiTKModelExists(loaiTKModel.IDLTK)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(loaiTKModel)); }
public async Task <IActionResult> Create([Bind("IDLTK,TenLTK,TrangThai")] LoaiTKModel loaiTKModel) { if (ModelState.IsValid) { _context.Add(loaiTKModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(loaiTKModel)); }