public async Task <IActionResult> Edit(int id, [Bind("MaKh,HoTen,NamSinh,GioiTinh,NgheNghiep,Cmnd,Sdt,Email,DiaChi,LoaiKH,NgayThamGia,MaTk,DiemTichLuy,DiemHienCo,TrangThai,LoaiKhachHang")] TblKhachHang tblKhachHang)
        {
            if (id != tblKhachHang.MaKh)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblKhachHang);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TblKhachHangExists(tblKhachHang.MaKh))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Profile)));
            }
            return(View(tblKhachHang));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("MaTk,TenDangNhap,MatKhau,MaQuyen")] TblTaiKhoan tblTaiKhoan)
        {
            if (id != tblTaiKhoan.MaTk)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblTaiKhoan);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TblTaiKhoanExists(tblTaiKhoan.MaTk))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MaQuyen"] = new SelectList(_context.TblQuyen, "MaQuyen", "TenQuyen", tblTaiKhoan.MaQuyen);
            return(View(tblTaiKhoan));
        }