public async Task <IActionResult> Edit(int id, [Bind("IDLG,TenLoai,GiaLG,TrangThai")] LoaiGheModel loaiGheModel) { if (id != loaiGheModel.IDLG) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(loaiGheModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LoaiGheModelExists(loaiGheModel.IDLG)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(loaiGheModel)); }
public async Task <IActionResult> Create([Bind("IDLG,TenLoai,GiaLG,TrangThai")] LoaiGheModel loaiGheModel) { if (ModelState.IsValid) { _context.Add(loaiGheModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(loaiGheModel)); }