Beispiel #1
0
 public ActionResult Edit([Bind(Include = "MaKH,TenKH,TaiKhoanKH,MatKhauKH,DiaChiKH,SDTKH,EmailKH,GioiTinhKH")] KhachHang khachHang)
 {
     if (ModelState.IsValid)
     {
         if (Common.MaNV != "")
         {
         }
         else
         {
             Common.Alert = "Đăng nhập trước khi chỉnh sữa !";
             return(RedirectToAction("Index", "Logins"));
         }
         db.Entry(khachHang).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(khachHang));
 }
 public ActionResult Edit([Bind(Include = "MaNSX,TenNSX,QuocGiaNSX,DiaChiNSX,MoTaNSX,GhiChuNSX")] NhaSanXuat nhaSanXuat)
 {
     if (ModelState.IsValid)
     {
         db.Entry(nhaSanXuat).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(nhaSanXuat));
 }
 public ActionResult Edit([Bind(Include = "MaNhomSP,TenNhomSP,MoTaNhomSP")] NhomSanPham nhomSanPham)
 {
     if (ModelState.IsValid)
     {
         db.Entry(nhomSanPham).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(nhomSanPham));
 }
Beispiel #4
0
 public ActionResult Edit([Bind(Include = "productoID,Nombre,precio")] Producto producto)
 {
     if (ModelState.IsValid)
     {
         db.Entry(producto).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(producto));
 }
Beispiel #5
0
 public ActionResult Edit([Bind(Include = "MaTT,TenTT,MoTaTT")] TrangThaiDonHang trangThaiDonHang)
 {
     if (ModelState.IsValid)
     {
         db.Entry(trangThaiDonHang).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(trangThaiDonHang));
 }
 public ActionResult Edit([Bind(Include = "MaNCC,TenNCC,SDTNCC,DiaChiNCC,GhiChuNCC")] NhaCungCap nhaCungCap)
 {
     if (ModelState.IsValid)
     {
         db.Entry(nhaCungCap).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(nhaCungCap));
 }
Beispiel #7
0
 public ActionResult Edit([Bind(Include = "MaLoaiNV,TenLoaiNV,MoTaLoaiNV,QuyenSD")] LoaiNV loaiNV)
 {
     if (ModelState.IsValid)
     {
         db.Entry(loaiNV).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(loaiNV));
 }
Beispiel #8
0
 public ActionResult Edit([Bind(Include = "MaLoaiSP,TenLoaiSP,GhiChuLoaiSP")] LoaiSP loaiSP)
 {
     if (ModelState.IsValid)
     {
         db.Entry(loaiSP).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(loaiSP));
 }
Beispiel #9
0
 public ActionResult Edit([Bind(Include = "MaNV,MaLoaiNV,TenNV,NgaySinh,QueQuan,GioiTinh,SDTNV,NgayKyHopDong,TaiKhoan,MatKhau,EmailNV,DiaChiNV")] NhanVien nhanVien)
 {
     if (ModelState.IsValid)
     {
         db.Entry(nhanVien).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MaLoaiNV = new SelectList(db.LoaiNV, "MaLoaiNV", "TenLoaiNV", nhanVien.MaLoaiNV);
     return(View(nhanVien));
 }
Beispiel #10
0
 public ActionResult Edit([Bind(Include = "MaGiaSP,GiaSauUpdate,GiaSPHienTai,NgayCapNhat,NgayApDung")] GiaSP giaSP)
 {
     if (ModelState.IsValid)
     {
         if (Common.MaNV != "")
         {
         }
         else
         {
             Common.Alert = "Đăng nhập trước khi chỉnh sữa !";
             return(RedirectToAction("Index", "Logins"));
         }
         db.Entry(giaSP).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(giaSP));
 }
Beispiel #11
0
 public ActionResult Edit([Bind(Include = "MaKM,TenKM,MoTaKM,NgayBatDauKM,ThoiGianKM")] KhuyenMai khuyenMai)
 {
     if (ModelState.IsValid)
     {
         if (Common.MaNV != "")
         {
         }
         else
         {
             Common.Alert = "Đăng nhập trước khi chỉnh sữa !";
             return(RedirectToAction("Index", "Logins"));
         }
         db.Entry(khuyenMai).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(khuyenMai));
 }
Beispiel #12
0
 public ActionResult Edit([Bind(Include = "MaKHCT,MaKH,SoHangDaMua,TongTien,DiaChiThuongDung")] ChiTietKH chiTietKH)
 {
     if (ModelState.IsValid)
     {
         if (Common.MaNV != "")
         {
         }
         else
         {
             Common.Alert = "Đăng nhập trước khi chỉnh sữa !";
             return(RedirectToAction("Index", "Logins"));
         }
         db.Entry(chiTietKH).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MaKH = new SelectList(db.KhachHang, "MaKH", "TenKH", chiTietKH.MaKH);
     return(View(chiTietKH));
 }
Beispiel #13
0
        public async Task <ActionResult> Edit([Bind(Include = "MaHTTT,TenHTTT,MoToHTTT")] HinhThucThanhToan hinhThucThanhToan)
        {
            if (ModelState.IsValid)
            {
                if (Common.MaNV != "")
                {
                }
                else
                {
                    Common.Alert = "Đăng nhập trước khi chỉnh sữa !";
                    return(RedirectToAction("Index", "Logins"));
                }
                db.Entry(hinhThucThanhToan).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(hinhThucThanhToan));
        }
Beispiel #14
0
        public ActionResult Edit([Bind(Include = "MaBH,HinhThucBH,MoTaBH")] BaoHanh baoHanh)
        {
            if (ModelState.IsValid)
            {
                if (Common.MaNV != "")
                {
                }
                else
                {
                    Common.Alert = "Đăng nhập trước khi chỉnh sữa !";
                    return(RedirectToAction("Index", "Logins"));
                }

                db.Entry(baoHanh).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(baoHanh));
        }
        public ActionResult Edit([Bind(Include = "MaCTDH,MaDonHang,SerialNumber,DonGiaCT,DiaChiGiaoHang")] ChiTietDonHang chiTietDonHang)
        {
            int?   gia;
            string serial = Request["SerialNumber"];
            var    giasp  = from p in db.SanPham join q in db.GiaSP on p.MaGiaSP equals q.MaGiaSP where p.SerialNumber == serial select p.GiaSP.GiaSPHienTai;

            foreach (var i in giasp)
            {
                chiTietDonHang.DonGiaCT = Convert.ToInt32(i);
            }
            if (ModelState.IsValid)
            {
                db.Entry(chiTietDonHang).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.SerialNumber = new SelectList(db.SanPham, "SerialNumber", "MaLoaiSP", chiTietDonHang.SerialNumber);
            ViewBag.MaDonHang    = new SelectList(db.DonHang, "MaDonHang", "MaDonHang", chiTietDonHang.MaDonHang);
            return(View(chiTietDonHang));
        }
 public ActionResult Edit([Bind(Include = "MaPN,MaNCC,MaNV,NgayNhap,GhiChuPN,SLNhap")] PhieuNhapSP phieuNhapSP)
 {
     if (ModelState.IsValid)
     {
         if (Common.MaNV != "")
         {
         }
         else
         {
             Common.Alert = "Đăng nhập trước khi chỉnh sữa !";
             return(RedirectToAction("Index", "Logins"));
         }
         db.Entry(phieuNhapSP).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MaNCC = new SelectList(db.NhaCungCap, "MaNCC", "TenNCC", phieuNhapSP.MaNCC);
     ViewBag.MaNV  = new SelectList(db.NhanVien, "MaNV", "MaLoaiNV", phieuNhapSP.MaNV);
     return(View(phieuNhapSP));
 }
Beispiel #17
0
        public ActionResult Edit([Bind(Include = "MaCTNhap,MaPN,SerialNumber,GiaNhap")] ChiTietNhap chiTietNhap)
        {
            if (Common.MaNV != "")
            {
                if (ModelState.IsValid)
                {
                    db.Entry(chiTietNhap).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                Common.Alert = "Đăng nhập trước khi chỉnh sữa !";
                return(RedirectToAction("Index", "Logins"));
            }

            ViewBag.MaPN         = new SelectList(db.PhieuNhapSP, "MaPN", "MaNCC", chiTietNhap.MaPN);
            ViewBag.SerialNumber = new SelectList(db.SanPham, "SerialNumber", "SerialNumber", chiTietNhap.SerialNumber);
            return(View(chiTietNhap));
        }
Beispiel #18
0
 public ActionResult Edit([Bind(Include = "MaCTBH,SerialNumber,MaNV,MaBH,TrangThai,NgayBH,GhiChuBH,NgayTra")] ChiTietBH chiTietBH)
 {
     if (ModelState.IsValid)
     {
         if (Common.MaNV != "")
         {
         }
         else
         {
             Common.Alert = "Đăng nhập trước khi chỉnh sữa !";
             return(RedirectToAction("Index", "Logins"));
         }
         db.Entry(chiTietBH).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MaBH         = new SelectList(db.BaoHanh, "MaBH", "HinhThucBH", chiTietBH.MaBH);
     ViewBag.MaNV         = new SelectList(db.NhanVien, "MaNV", "TenNV");
     ViewBag.SerialNumber = new SelectList(db.SanPham, "SerialNumber", "SerialNumber", chiTietBH.SerialNumber);
     return(View(chiTietBH));
 }
Beispiel #19
0
 public ActionResult Edit([Bind(Include = "SerialNumber,MaLoaiSP,MaNSX,MaGiaSP,MaKM,MaNhomSP,TenSP,SLTonKho,MoTaNgan,MoTaChiTiet,TGBaoHanh")] SanPham sanPham)
 {
     if (ModelState.IsValid)
     {
         if (Common.MaNV != "")
         {
         }
         else
         {
             Common.Alert = "Đăng nhập trước khi chỉnh sữa !";
             return(RedirectToAction("Index", "Logins"));
         }
         db.Entry(sanPham).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MaGiaSP  = new SelectList(db.GiaSP, "MaGiaSP", "MaGiaSP", sanPham.MaGiaSP);
     ViewBag.MaKM     = new SelectList(db.KhuyenMai, "MaKM", "TenKM", sanPham.MaKM);
     ViewBag.MaLoaiSP = new SelectList(db.LoaiSP, "MaLoaiSP", "TenLoaiSP", sanPham.MaLoaiSP);
     ViewBag.MaNSX    = new SelectList(db.NhaSanXuat, "MaNSX", "TenNSX", sanPham.MaNSX);
     ViewBag.MaNhomSP = new SelectList(db.NhomSanPham, "MaNhomSP", "TenNhomSP", sanPham.MaNhomSP);
     return(View(sanPham));
 }
Beispiel #20
0
 public ActionResult Edit([Bind(Include = "MaDonHang,MaHTTT,MaTT,MaKH,MaNV,NgayMua,GhiChuDonHang,SoLuongCT,TongTienDH")] DonHang donHang)
 {
     if (ModelState.IsValid)
     {
         if (Common.MaNV != "")
         {
             donHang.MaNV = Common.MaNV;
         }
         else
         {
             Common.Alert = "Đăng nhập trước khi chỉnh sữa !";
             return(RedirectToAction("Login", "Logins"));
         }
         db.Entry(donHang).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MaHTTT = new SelectList(db.HinhThucThanhToan, "MaHTTT", "TenHTTT", donHang.MaHTTT);
     ViewBag.MaNV   = new SelectList(db.NhanVien, "MaNV", "TenNV", donHang.MaNV);
     ViewBag.MaTT   = new SelectList(db.TrangThaiDonHang, "MaTT", "TenTT", donHang.MaTT);
     ViewBag.MaKH   = new SelectList(db.KhachHang, "MaKH", "MaKH", donHang.MaKH);
     return(View(donHang));
 }
        public ActionResult Edit([Bind(Include = "MaHASP,SerialNumber,LinkHASP")] HinhAnhSP hinhAnhSP)
        {
            var Image = Request.Files["Image"];
            var path  = Server.MapPath("~/Images/" + Image.FileName);

            Image.SaveAs(path);
            if (ModelState.IsValid)
            {
                if (Common.MaNV != "")
                {
                }
                else
                {
                    Common.Alert = "Đăng nhập trước khi chỉnh sữa !";
                    return(RedirectToAction("Index", "Logins"));
                }
                hinhAnhSP.LinkHASP        = "/Images/" + Image.FileName;
                db.Entry(hinhAnhSP).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.SerialNumber = new SelectList(db.SanPham, "SerialNumber", "SerialNumber", hinhAnhSP.SerialNumber);
            return(View(hinhAnhSP));
        }
Beispiel #22
0
 public void Update(TodoItem todo)
 {
     _context.Entry(todo).State = EntityState.Modified;
     _context.SaveChanges();
 }