public ActionResult Create([Bind(Include = "MaHASP,SerialNumber,LinkHASP")] HinhAnhSP hinhAnhSP) { var Image = Request.Files["Image"]; var path = Server.MapPath("~/Images/" + Image.FileName); Image.SaveAs(path); var sl = from p in db.HinhAnhSP select p; int a = sl.Count() + 1; if (ModelState.IsValid) { if (Common.MaNV != "") { } else { Common.Alert = "Đăng nhập trước khi chỉnh sữa !"; return(RedirectToAction("Index", "Logins")); } hinhAnhSP.MaHASP = a.ToString(); hinhAnhSP.LinkHASP = "/Images/" + Image.FileName; db.HinhAnhSP.Add(hinhAnhSP); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SerialNumber = new SelectList(db.SanPham, "SerialNumber", "SerialNumber", hinhAnhSP.SerialNumber); return(View(hinhAnhSP)); }
public ActionResult Create([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")); } sanPham.SLTonKho = 1; db.SanPham.Add(sanPham); 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)); }
public ActionResult Create([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); } var count = from sl in db.ChiTietDonHang select sl; int a = KTTonTai(count.Count()); if (ModelState.IsValid) { chiTietDonHang.MaCTDH = a; db.ChiTietDonHang.Add(chiTietDonHang); 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 Create([Bind(Include = "MaCTBH,SerialNumber,MaNV,MaBH,TrangThai,NgayBH,GhiChuBH,NgayTra")] ChiTietBH chiTietBH) { var count = from sl in db.ChiTietBH select sl; int a = KTTonTai(count.Count()); if (ModelState.IsValid) { if (Common.MaNV != "") { } else { Common.Alert = "Đăng nhập trước khi chỉnh sữa !"; return(RedirectToAction("Index", "Logins")); } chiTietBH.MaCTBH = a; db.ChiTietBH.Add(chiTietBH); 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)); }
public ActionResult Create([Bind(Include = "MaNCC,TenNCC,SDTNCC,DiaChiNCC,GhiChuNCC")] NhaCungCap nhaCungCap) { if (ModelState.IsValid) { db.NhaCungCap.Add(nhaCungCap); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nhaCungCap)); }
public ActionResult Create([Bind(Include = "MaNSX,TenNSX,QuocGiaNSX,DiaChiNSX,MoTaNSX,GhiChuNSX")] NhaSanXuat nhaSanXuat) { if (ModelState.IsValid) { db.NhaSanXuat.Add(nhaSanXuat); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nhaSanXuat)); }
public ActionResult Create([Bind(Include = "MaLoaiNV,TenLoaiNV,MoTaLoaiNV,QuyenSD")] LoaiNV loaiNV) { if (ModelState.IsValid) { db.LoaiNV.Add(loaiNV); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(loaiNV)); }
public ActionResult Create([Bind(Include = "MaTT,TenTT,MoTaTT")] TrangThaiDonHang trangThaiDonHang) { if (ModelState.IsValid) { db.TrangThaiDonHang.Add(trangThaiDonHang); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(trangThaiDonHang)); }
public ActionResult Create([Bind(Include = "MaNhomSP,TenNhomSP,MoTaNhomSP")] NhomSanPham nhomSanPham) { if (ModelState.IsValid) { db.NhomSanPham.Add(nhomSanPham); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nhomSanPham)); }
public ActionResult Create([Bind(Include = "MaLoaiSP,TenLoaiSP,GhiChuLoaiSP")] LoaiSP loaiSP) { if (ModelState.IsValid) { db.LoaiSP.Add(loaiSP); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(loaiSP)); }
public ActionResult Create([Bind(Include = "productoID,Nombre,precio")] Producto producto) { if (ModelState.IsValid) { db.Productoes.Add(producto); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(producto)); }
public ActionResult Create([Bind(Include = "MaNV,MaLoaiNV,TenNV,NgaySinh,QueQuan,GioiTinh,SDTNV,NgayKyHopDong,TaiKhoan,MatKhau,EmailNV,DiaChiNV")] NhanVien nhanVien) { if (ModelState.IsValid) { db.NhanVien.Add(nhanVien); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaLoaiNV = new SelectList(db.LoaiNV, "MaLoaiNV", "TenLoaiNV", nhanVien.MaLoaiNV); return(View(nhanVien)); }
public ActionResult Create([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.GiaSP.Add(giaSP); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(giaSP)); }
public ActionResult Create([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.KhuyenMai.Add(khuyenMai); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(khuyenMai)); }
public ActionResult Create([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.ChiTietKH.Add(chiTietKH); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaKH = new SelectList(db.KhachHang, "MaKH", "TenKH", chiTietKH.MaKH); return(View(chiTietKH)); }
public ActionResult Create([Bind(Include = "MaCTNhap,MaPN,SerialNumber,GiaNhap")] ChiTietNhap chiTietNhap) { if (ModelState.IsValid) { if (Common.MaNV != "") { } else { Common.Alert = "Đăng nhập trước khi chỉnh sữa !"; return(RedirectToAction("Index", "Logins")); } db.ChiTietNhap.Add(chiTietNhap); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaPN = new SelectList(db.PhieuNhapSP, "MaPN", "MaNCC", chiTietNhap.MaPN); ViewBag.SerialNumber = new SelectList(db.SanPham, "SerialNumber", "SerialNumber", chiTietNhap.SerialNumber); return(View(chiTietNhap)); }
public ActionResult Create([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")); } phieuNhapSP.MaNV = Common.MaNV; db.PhieuNhapSP.Add(phieuNhapSP); 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)); }
public ActionResult Create([Bind(Include = "MaDonHang,MaHTTT,MaTT,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("Index", "Logins")); } db.DonHang.Add(donHang); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaHTTT = new SelectList(db.HinhThucThanhToan, "MaHTTT", "TenHTTT", donHang.MaHTTT); ViewBag.MaNV = new SelectList(db.NhanVien, "MaNV", "MaLoaiNV", 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 Create([Bind(Include = "MaBH,HinhThucBH,MoTaBH")] BaoHanh baoHanh) { var sl = from p in db.BaoHanh select p; int i = sl.Count() + 1; if (ModelState.IsValid) { if (Common.MaNV != "") { baoHanh.MaBH = "BH" + i.ToString(); } else { Common.Alert = "Đăng nhập trước khi chỉnh sữa !"; return(RedirectToAction("Index", "Logins")); } db.BaoHanh.Add(baoHanh); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(baoHanh)); }
public ActionResult Create([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.KhachHang.Add(khachHang); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(khachHang)); }
public void Create(TodoItem todo) { _context.Todos.Add(todo); _context.SaveChanges(); }