public async Task <IActionResult> Edit(int id, [Bind("Idkhachhang,Hotenkhachhang,Diachikhachhang")] Khachhang khachhang) { if (id != khachhang.Idkhachhang) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(khachhang); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!KhachhangExists(khachhang.Idkhachhang)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(khachhang)); }
public async Task <IActionResult> Edit(int id, [Bind("Idmathang,Tenhang,Loaihang,Quycach,Giaban,Soluong")] Mathang mathang) { if (id != mathang.Idmathang) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(mathang); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MathangExists(mathang.Idmathang)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(mathang)); }