示例#1
0
        public async Task <IActionResult> Edit(string id, [Bind("MaMH,Ten,MaLH,MaDVT,NgaySanXuat,SoLuongNhap,SoLuongBan,GiaBan,GiaMua,VAT,MoTa,NgayNhap,NgayHetHan,HinhMinhHoa")] MatHang matHang)
        {
            if (id != matHang.MaMH)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(matHang);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MatHangExists(matHang.MaMH))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MaDVT"] = new SelectList(_context.DonViTinhs, "MaDVT", "MaDVT", matHang.MaDVT);
            ViewData["MaLH"]  = new SelectList(_context.LoaiHangs, "MaLH", "MaLH", matHang.MaLH);
            return(View(matHang));
        }
示例#2
0
        public async Task <IActionResult> Edit(string id, [Bind("MaLH,Ten,MaCL")] LoaiHang loaiHang)
        {
            if (id != loaiHang.MaLH)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(loaiHang);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LoaiHangExists(loaiHang.MaLH))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MaCL"] = new SelectList(_context.ChungLoais, "MaCL", "MaCL", loaiHang.MaCL);
            return(View(loaiHang));
        }
        public async Task <IActionResult> Edit(string id, [Bind("MaCV,Ten")] ChucVu chucVu)
        {
            if (id != chucVu.MaCV)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(chucVu);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ChucVuExists(chucVu.MaCV))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(chucVu));
        }
示例#4
0
        public async Task <IActionResult> Edit(string id, [Bind("MaHD,ThoiDiemLap,TongTienPhaiTra,MucGiam,MaNV,MaKH,DiemThuong")] HoaDon hoaDon)
        {
            if (id != hoaDon.MaHD)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hoaDon);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HoaDonExists(hoaDon.MaHD))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MaKH"] = new SelectList(_context.KhachHangs, "MaKH", "MaKH", hoaDon.MaKH);
            ViewData["MaNV"] = new SelectList(_context.NhanViens, "MaNV", "MaNV", hoaDon.MaNV);
            return(View(hoaDon));
        }
示例#5
0
        public async Task <IActionResult> Edit(string id, [Bind("MaKH,Ten,DiaChi,DienThoai,NgayCapThe,Anh,NgayMuaGanNhat,DiemThuong")] KhachHang khachHang)
        {
            if (id != khachHang.MaKH)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(khachHang);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!KhachHangExists(khachHang.MaKH))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(khachHang));
        }
        public async Task <IActionResult> Edit(string id, [Bind("MaNV,Ten,NgaySinh,Phai,CMND,DiaChi,DienThoai,NgayVaoLam,MucGiam,MaCV,Username,Pwd,avatar,allowed")] NhanVien nhanVien)
        {
            if (id != nhanVien.MaNV)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(nhanVien);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NhanVienExists(nhanVien.MaNV))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(nhanVien));
        }
示例#7
0
        public async Task <IActionResult> Edit(string id, [Bind("MaHD,SoLuong,MaMH")] ChiTietHoaDon chiTietHoaDon)
        {
            if (id != chiTietHoaDon.MaHD)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(chiTietHoaDon);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ChiTietHoaDonExists(chiTietHoaDon.MaHD))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(chiTietHoaDon));
        }
示例#8
0
        public async Task <IActionResult> Edit(string id, [Bind("MaDVT,Ten")] DonViTinh donViTinh)
        {
            if (id != donViTinh.MaDVT)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(donViTinh);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DonViTinhExists(donViTinh.MaDVT))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(donViTinh));
        }
        public async Task <IActionResult> Edit(string id, [Bind("MaNCC,Ten,DiaChi,DienThoai")] NhaCungCap nhaCungCap)
        {
            if (id != nhaCungCap.MaNCC)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(nhaCungCap);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NhaCungCapExists(nhaCungCap.MaNCC))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(nhaCungCap));
        }
示例#10
0
        public async Task <TEntity> UpdateAsync(TEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException($"{nameof(AddAsync)} entity must not be null");
            }

            try
            {
                _context.Update(entity);
                await _context.SaveChangesAsync();

                return(entity);
            }
            catch (Exception ex)
            {
                throw new Exception($"{nameof(entity)} could not be updated: {ex.Message}");
            }
        }