// GET: Admin/SanPham/Edit/5 public ActionResult Edit(int id) { var rs = SanPhamBus.ChiTiet(id); List <CustomDropDownList> BiXoa = new List <CustomDropDownList>() { new CustomDropDownList { Text = "Không Xóa", Value = 0 }, new CustomDropDownList { Text = "Xóa", Value = 1 } }; List <CustomDropDownList> TinhTrang = new List <CustomDropDownList>() { new CustomDropDownList { Text = "Còn Hàng", Value = 1 }, new CustomDropDownList { Text = "Hết Hàng", Value = 0 } }; ViewBag.TinhTrang = new SelectList(TinhTrang, "Value", "Text"); ViewBag.BiXoa = new SelectList(BiXoa, "Value", "Text"); ViewBag.MaHang = new SelectList(HangBus.DanhSach(), "MaHang", "TenHang", rs.MaHang); ViewBag.MaLoai = new SelectList(LoaiBus.DanhSach(), "MaLoai", "TenLoai", rs.MaLoai); return(View(rs)); }
public ActionResult NhaSanXuat(int MaNSX) { var ds = SanPhamBus.SanPhambyNSX(MaNSX); ViewBag.NhaSanXuat = NhaSanXuatBus.ChiTiet(MaNSX); return(View(ds)); }
public ActionResult Index() { var SanPhamBanChay = SanPhamBus.List(6, "ASC"); ViewBag.SanPhamMoiVe = SanPhamBus.List(12, "DESC"); return(View(SanPhamBanChay)); }
// GET: Product public ActionResult Index(int id, int page = 1) { ViewBag.SanPhamBanChay = SanPhamBus.List(6, "ASC"); var LisrProduct = SanPhamBus.GetProductByProductType(page, 3, id); return(View(LisrProduct)); }
private void btnThem_Click(object sender, EventArgs e) { SanPhamBus bussp = new SanPhamBus(); SanPhamEntity sp = new SanPhamEntity(); KetNoiCSDL con = new KetNoiCSDL(); try { sp.MaSP = con.SinhMa("SANPHAM", "SP"); sp.TenSP = txtTenSP.Text; sp.SoLuong = int.Parse(txtSoLuong.Text); sp.GiaBan = int.Parse(txtGiaBan.Text); sp.GiaNhap = int.Parse(txtGiaNhap.Text); sp.MaLH = cboLoaiHang.SelectedValue.ToString(); sp.NhaCC = cboNhaCC.SelectedValue.ToString(); sp.NSX = dtNgaySX.Value.ToString(); sp.MoTa = rtbMoTa.Text; sp.HinhAnh = null; bussp.ThemSanPham(sp); MessageBox.Show("Nhập hàng thành công", "Thông báo"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
// GET: SanPham/Details/5 public ActionResult Details(int id) { var ctSanPham = SanPhamBus.ChiTietSanPham(id); ViewBag.sanphamlienquan = SanPhamBus.ListSPLQ(id); return(View(ctSanPham)); }
public ActionResult Index(int?page) { int pageNumber = (page ?? 1); int itemsPerPage = 3; var DSSanPham = SanPhamBus.DanhSach(pageNumber, itemsPerPage); return(View(DSSanPham)); }
// GET: Admin/SanPhamAdmin/Edit/5 public ActionResult Edit(int id) { ViewBag.MaHang = new SelectList(NhaSanXuatBus.DanhSach(), "MaHang", "TenHang"); ViewBag.MaLoai = new SelectList(LoaiSanPhamBus.DanhSach(), "MaLoai", "TenLoai"); ViewBag.MaTinhTrang = new SelectList(TinhTrangSanPhamBus.DanhSach(), "MaTinhTrang", "TenTinhTrang"); var db = SanPhamBus.ChiTiet(id); return(View(db)); }
// GET: SanPham/Details/5 public ActionResult Details(int id) { var sp = SanPhamBus.ChiTiet(id); var nsx = NhaSanXuatBus.ChiTiet(sp.MaNSX); return(View(new SanPhamViewModels() { SanPham = sp, NhaSanXuat = nsx })); }
// GET: SanPham/Details/5 public ActionResult Details(int id) { var ChiTietSP = SanPhamBus.ChiTiet(id); var ChiTietLoaiSP = LoaiBus.ChiTietViewModel(ChiTietSP.MaLoai); var ChitTietHangSP = HangBus.ChiTietViewModel(ChiTietSP.MaLoai); return(View(new SanPhamViewModel() { LoaiSP = ChiTietLoaiSP, HangSP = ChitTietHangSP, SanPham = ChiTietSP })); }
public ActionResult TimKiem(string SearchTerm) { var dsSanPham = SanPhamBus.HienThiDanhSachSanPham(); if (!String.IsNullOrEmpty(SearchTerm)) { dsSanPham = SanPhamBus.TimKiem(SearchTerm); } ViewBag.SearchTerm = SearchTerm; return(View(dsSanPham)); }
// GET: SanPham/Details/5 public ActionResult Details(int id) { var BinhLuan = BinhLuanBus.DanhSach(id); var ChiTiet = SanPhamBus.ChiTiet(id); var data = new SanPhamViewModels() { SanPham = ChiTiet, BinhLuanSP = BinhLuan }; return(View(data)); }
public ActionResult Edit(int id, SanPham sp) { try { // TODO: Add update logic here SanPhamBus.Sua(id, sp); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(SanPham sp) { try { // TODO: Add insert logic here SanPhamBus.Them(sp); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(sanpham sp) { //try //{ // TODO: Add insert logic here SanPhamBus.Them(sp); return(RedirectToAction("Index")); //} //catch //{ // return View(); //} }
public ActionResult Delete(int id, FormCollection collection) { try { // TODO: Add delete logic here SanPhamBus.Xoa(id); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: Product/Details/5 public ActionResult Details(int id) { ViewBag.SanPhamBanChay = SanPhamBus.List(6, "ASC"); var sp = SanPhamBus.Details(id); ViewBag.LSP = Models.LoaiSanPhamBus.LoaiSanPhamBus.DanhSach(); ViewBag.SanPhamLienQuan = SanPhamBus.RelatedProductsDetails(id, 6, sp.LoaiSp); ViewBag.listimg = DanhSachHinh.danhsach(id); return(View(sp)); }
public ActionResult Create(SanPham sp) { if (HttpContext.Request.Files.Count > 0) { var hpf = HttpContext.Request.Files[0]; if (hpf.ContentLength > 0) { string fileName = Guid.NewGuid().ToString(); string fullPathWithFileName = "/ShopOnline/img/" + fileName + ".jpg"; hpf.SaveAs(Server.MapPath(fullPathWithFileName)); sp.HinhAnh = fileName + ".jpg"; } } SanPhamBus.Them(sp); return(RedirectToAction("Index")); }
public ActionResult Create(SanPham sp) { { // TODO: Add insert logic here //Hàm thêm if (HttpContext.Request.Files.Count > 0) { } var hpf = HttpContext.Request.Files[0]; if (hpf.ContentLength > 0) { string fileName = Guid.NewGuid().ToString(); string fileName1 = Guid.NewGuid().ToString(); string fileName2 = Guid.NewGuid().ToString(); string fileName3 = Guid.NewGuid().ToString(); string fileName4 = Guid.NewGuid().ToString(); string fullPathWithFileName = "/Assets/img/products/" + fileName + ".jpg"; string fullPathWithFileName1 = "/Assets/img/products/" + fileName + ".jpg"; string fullPathWithFileName2 = "/Assets/img/products/" + fileName + ".jpg"; string fullPathWithFileName3 = "/Assets/img/products/" + fileName + ".jpg"; string fullPathWithFileName4 = "/Assets/img/products/" + fileName + ".jpg"; hpf.SaveAs(Server.MapPath(fullPathWithFileName)); hpf.SaveAs(Server.MapPath(fullPathWithFileName1)); hpf.SaveAs(Server.MapPath(fullPathWithFileName2)); hpf.SaveAs(Server.MapPath(fullPathWithFileName3)); hpf.SaveAs(Server.MapPath(fullPathWithFileName4)); sp.HinhAnh = fullPathWithFileName; sp.HinhAnh1 = fullPathWithFileName1; sp.HinhAnh2 = fullPathWithFileName2; sp.HinhAnh3 = fullPathWithFileName3; sp.HinhAnh4 = fullPathWithFileName4; } } sp.TinhTrang = 0; SanPhamBus.ThemSP(sp); return(RedirectToAction("Index")); }
public ActionResult Edit(int id, SanPham sp) { var db = new MobileShopConnectionDB(); var rs = db.SingleOrDefault <MobileShopConnection.SanPham>("select HinhAnh from sanpham where MaSP=@0", id); if (HttpContext.Request.Files.Count > 0) { var hpf = HttpContext.Request.Files[0]; if (hpf.ContentLength > 0) { string fileName = Guid.NewGuid().ToString(); string fullPathWithFileName = "/ShopOnline/img/" + fileName + ".jpg"; hpf.SaveAs(Server.MapPath(fullPathWithFileName)); sp.HinhAnh = fileName + ".jpg"; } else { sp.HinhAnh = rs.HinhAnh; } } SanPhamBus.Sua(sp); return(RedirectToAction("Index")); }
// GET: Home public ActionResult Index(int page = 1) { var dsSanPham = SanPhamBus.DanhSach(page, 6); return(View(dsSanPham)); }
public ActionResult Restore(int id) { SanPhamBus.KhoiPhuc(id); return(RedirectToAction("Deleted")); }
public ActionResult Deleted(int Page = 1) { var DsSanPham = SanPhamBus.PageDanhSachDaXoa(Page, 10); return(View(DsSanPham)); }
// GET: Admin/SanPham/Details/5 public ActionResult Details(int id) { var ChiTiet = SanPhamBus.ChiTiet(id); return(View(ChiTiet)); }
// GET: Admin/SanPham/Delete/5 public ActionResult Delete(int id) { var rs = SanPhamBus.ChiTiet(id); return(View(rs)); }
// GET: Admin/SanPham public ActionResult Index(int Page = 1) { var DsSanPham = SanPhamBus.PageDanhSach(Page, 10); return(View(DsSanPham)); }
// GET: SanPham public ActionResult Index() { var dsSanPham = SanPhamBus.DanhSach(); return(View(dsSanPham)); }
public ActionResult Index() { return(View(SanPhamBus.List())); }
public ActionResult Details(int id) { return(View(SanPhamBus.ChiTiet(id))); }
// GET: SanPham public ActionResult Index() { var DSSanPham = SanPhamBus.DanhSach(2, 3); return(View(DSSanPham)); }