예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("IdKhachHang,NameKh,Email,Password,Address,SoDiethoai")] 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));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("IdHd,IdSp,Soluong,GiaSp")] Chitiethd chitiethd)
        {
            if (id != chitiethd.IdHd)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(chitiethd);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ChitiethdExists(chitiethd.IdHd))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdHd"] = new SelectList(_context.Hoadon, "Idhoadon", "Idhoadon", chitiethd.IdHd);
            ViewData["IdSp"] = new SelectList(_context.Sanpham, "IdsanPham", "IdsanPham", chitiethd.IdSp);
            return(View(chitiethd));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("IdsanPham,TenSp,GiaSp,MoTa,DanhMuc")] Sanpham sanpham)
        {
            if (id != sanpham.IdsanPham)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sanpham);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SanphamExists(sanpham.IdsanPham))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DanhMuc"] = new SelectList(_context.Danhmuc, "IddanhMuc", "IddanhMuc", sanpham.DanhMuc);
            return(View(sanpham));
        }
예제 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("IddanhMuc,TenDm")] Danhmuc danhmuc)
        {
            if (id != danhmuc.IddanhMuc)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(danhmuc);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DanhmucExists(danhmuc.IddanhMuc))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(danhmuc));
        }
예제 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Idhoadon,IdNguoimua,IdchiTiet,TongTien,SoLuong,NgayTao,TinhTrang")] Hoadon hoadon)
        {
            if (id != hoadon.Idhoadon)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hoadon);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HoadonExists(hoadon.Idhoadon))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdNguoimua"] = new SelectList(_context.Khachhang, "IdKhachHang", "Email", hoadon.IdNguoimua);
            return(View(hoadon));
        }