Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,TenKhachHang,SoDienThoai,Email,DiaChi,TongTien")] DonHang donHang)
        {
            if (id != donHang.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(donHang);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DonHangExists(donHang.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(donHang));
        }
Пример #2
0
        //Ajax thay đổi trạng thái thay đổi sản phẩm bán chạy
        public async Task <IActionResult> ThayDoiHienThi(int?idsp)
        {
            if (idsp == null)
            {
                return(NotFound());
            }

            var sanPham = await _context.SanPham.SingleOrDefaultAsync(m => m.ID == idsp);

            sanPham.HienThi = !sanPham.HienThi;
            _context.Update(sanPham);
            await _context.SaveChangesAsync();

            return(Content("Thay đổi thành công"));
        }
Пример #3
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,HoTen,Email,SoDienThoai,NoiDung")] BinhLuan binhLuan)
        {
            if (id != binhLuan.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(binhLuan);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BinhLuanExists(binhLuan.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(binhLuan));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,SanPhamID,DonHangID,Gia,SoLuong,TongTien")] ChiDietDonHang chiDietDonHang)
        {
            if (id != chiDietDonHang.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(chiDietDonHang);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ChiDietDonHangExists(chiDietDonHang.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(chiDietDonHang));
        }
Пример #5
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,sanPhamID,maBaoHanh,ngayBan")] SanPhamBan SanPhamBan)
        {
            if (id != SanPhamBan.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(SanPhamBan);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SanPhamBanExists(SanPhamBan.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(SanPhamBan));
        }
Пример #6
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,TenLoaiSPCoDau,TenLoaiSPKhongDau")] LoaiSanPham loaiSanPham)
        {
            if (id != loaiSanPham.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(loaiSanPham);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LoaiSanPhamExists(loaiSanPham.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(loaiSanPham));
        }
Пример #7
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,TenNSXCoDau,TenNSXKhongDau")] NhaSanXuat nhaSanXuat)
        {
            if (id != nhaSanXuat.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(nhaSanXuat);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NhaSanXuatExists(nhaSanXuat.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(nhaSanXuat));
        }
Пример #8
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,TieuDeKhuyenMai,HinhAnh,NoiDung")] KhuyenMai khuyenMai)
        {
            if (id != khuyenMai.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(khuyenMai);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!KhuyenMaiExists(khuyenMai.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(khuyenMai));
        }