public ActionResult Them() { var dm = new DanhMucDAO(); ViewBag.Categories = dm.GetAll(); return(View("Them")); }
public ActionResult Delete(int id) { DanhMucDAO danhMucDAO = new DanhMucDAO(); danhMucDAO.Delete(id); return(RedirectToAction("Index")); }
// GET: Admin/DanhMuc public ActionResult IndexDanhMuc() { var iplDanhMuc = new DanhMucDAO(); var model = iplDanhMuc.ListDanhMuc(); return(View(model)); }
// GET: ChiTietSanPham/Details/5 public ActionResult Details(int id) { DanhMucDAO dm = new DanhMucDAO(); ViewBag.danhMuc = dm.GetAll().ToList(); return(View(db.Giays.Where(item => item.shoeId == id).SingleOrDefault())); }
// GET: Cart public ActionResult Index() { DanhMucDAO dm = new DanhMucDAO(); ViewBag.danhMuc = dm.GetAll().ToList(); return(View()); }
public ActionResult Edit(int id) { KhachHangDAO khDAO = new KhachHangDAO(); DanhMucDAO dm = new DanhMucDAO(); ViewBag.danhMuc = dm.GetAll().ToList(); return(View(khDAO.getUserById(id))); }
public DanhMucDTO LayTenDanhMuc(int maDM) { DanhMucDAO dmDAO = new DanhMucDAO(); DanhMucDTO dmDTO = null; dmDTO = dmDAO.LayTenDanhMuc(maDM); return(dmDTO); }
public ActionResult Sua(int id) { SanPham entity = SanPhamDAO.getShoeById(id); var dm = new DanhMucDAO(); ViewBag.Categories = dm.GetAll(); return(View(entity)); }
public DanhMucDTO LayMaDanhMuc(string tenDM) { DanhMucDAO dmDAO = new DanhMucDAO(); DanhMucDTO dmDTO = null; dmDTO = dmDAO.LayMaDanhMuc(tenDM); return(dmDTO); }
// GET: Admin/DanhMucBaiViet public ActionResult Index(string searchString, int page = 1, int pageSize = 5) { var dao = new DanhMucDAO(); var model = dao.ListAllPaging(searchString, page, pageSize); ViewBag.SearchString = searchString; return(View(model)); }
public ActionResult CreateDanhMuc([Bind(Include = "MaDM,TenDM,MetaTitle")] DanhMuc dm) { if (ModelState.IsValid) { DanhMucDAO danhMucDAO = new DanhMucDAO(); danhMucDAO.Create(dm); return(Redirect("Index")); } return(View("Create")); }
// GET: HangKhuyenMai public ActionResult Index(int?page) { int pageSize = 10; int pageNumber = page ?? 1; DanhMucDAO dm = new DanhMucDAO(); ViewBag.danhMuc = dm.GetAll().ToList(); var list = db.SanPhams.Where(item => item.comparePrice > item.price).ToList().ToPagedList(pageNumber, pageSize); return(PartialView(list)); }
public ActionResult EditDanhMuc(DanhMuc dm) { if (ModelState.IsValid) { DanhMucDAO danhMucDAO = new DanhMucDAO(); danhMucDAO.Edit(dm); return(Redirect("Index")); } else { return(View("Edit", dm)); } }
public ActionResult MyAccount() { DanhMucDAO dm = new DanhMucDAO(); ViewBag.danhMuc = dm.GetAll().ToList(); var userId = System.Web.HttpContext.Current.Session["USER_ID"]; if (userId != null) { var kh = db.KhachHangs.ToList().Where(item => item.userId == Convert.ToInt32(userId)).SingleOrDefault(); return(View(kh)); } return(RedirectToAction("Index")); }
protected void data_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Sua") { id = (string)e.CommandArgument; Response.Redirect("suachuyenmuc.aspx?id=" + id); } else { id = (string)e.CommandArgument; DanhMucDAO DAO = new DanhMucDAO(); DAO.XoaDanhMuc(id); LoadDuLieu(); } }
public ActionResult Index() { ViewBag.Slides = new SlideDAO().ListAll(); var productDAO = new ProductDAO(); var DanhMucDAO = new DanhMucDAO(); var DanhMucSanPhamDAO = new CategoryProductDAO(); ViewBag.NewProducts = productDAO.ListNewProduct(4); ViewBag.NewProducts1 = productDAO.ListNewProduct1(4); ViewBag.ListFeatureProducts = productDAO.ListFeatureProduct(4); ViewBag.SanPhamBanChay = productDAO.SanPhamBanChay(4); ViewBag.DanhMuc = DanhMucDAO.ListAll(); ViewBag.DanhMucSanPham = DanhMucSanPhamDAO.ListCategoryProduct(); ViewBag.SanPham = productDAO.ListAll(); return(View()); }
public ActionResult Edit(DanhMucBaiViet user) { var dao = new DanhMucDAO(); var result = dao.Update(user); if (result) { SetAlert("Sửa danh mục thành công", "success"); return(RedirectToAction("Index", "DanhMucBaiViet")); } else { ModelState.AddModelError("", "Cập nhật danh mục không thành công"); } return(View("Index")); }
public ActionResult KiemTraDonHang() { DanhMucDAO dm = new DanhMucDAO(); ViewBag.danhMuc = dm.GetAll().ToList(); var userId = Convert.ToInt32(System.Web.HttpContext.Current.Session["USER_ID"]); var dh = db.DonHangs.Where(donhang => donhang.userId == userId).Select(item => new DonHangViewModel() { address = item.address, createdAt = item.createdAt, orderId = item.orderId, status = item.status, totalMoney = db.ChiTietDonHangs.Where(i => i.orderId == item.orderId).Sum(i => i.price * i.quantity) }).ToList(); return(View(dh)); }
public ActionResult Shop(int?page, string currentFilter, string size = "all", string price = "0", string filterType = "all", string sortOrder = "option", string sortActive = "Tùy chọn") { DanhMucDAO dm = new DanhMucDAO(); SanPhamDAO x = new SanPhamDAO(); ViewBag.danhMuc = dm.GetAll().ToList(); ViewBag.price = price.ToString(); ViewBag.filterType = filterType; ViewBag.action = "Shop"; ViewBag.title = "Shop"; ViewBag.size = size; ViewBag.sortOrder = sortOrder; ViewBag.sortActive = sortActive; int pageSize = 4; int pageNumber = page ?? 1; return(View(x.GetAll().ToPagedList(pageNumber, pageSize))); }
public ActionResult GiayNam(int?page, string currentFilter, string size = "all", string price = "0", string filterType = "all", string sortOrder = "option", string sortActive = "Tùy chọn") { DanhMucDAO dm = new DanhMucDAO(); GiayDAO x = new GiayDAO(); ViewBag.danhMuc = dm.GetAll().ToList(); ViewBag.price = price.ToString(); ViewBag.filterType = filterType; ViewBag.action = "GiayNam"; ViewBag.title = "Giày nam"; ViewBag.size = size; ViewBag.sortOrder = sortOrder; ViewBag.sortActive = sortActive; int pageSize = 4; int pageNumber = page ?? 1; return(View(x.getProductsMale(size, price, filterType, sortOrder).ToPagedList(pageNumber, pageSize))); }
public ActionResult Create(DanhMucBaiViet model) { if (ModelState.IsValid) { var currentCulture = Session[CommonConstants.CurrentCulture]; var id = new DanhMucDAO().Insert(model); if (id > 0) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Thêm danh mục không thành công"); } } return(View(model)); }
protected void btnThem_Click(object sender, EventArgs e) { if (Page.IsValid) { string TenDanhMuc = txtTenDanhMuc.Text; DanhMuc danhMuc = new DanhMuc { Tendanhmuc = TenDanhMuc }; DanhMucDAO DAO = new DanhMucDAO(); if (DAO.ThemDanhMuc(danhMuc)) { lblThongBao.Text = "Thêm danh mục thành công."; } else { lblThongBao.Text = "Có lỗi trong quá trình thêm. Liên hệ DEV"; } } }
protected void btnSua_Click(object sender, EventArgs e) { if (Page.IsValid) { string TenDanhMuc = txtTenDanhMuc.Text; DanhMuc danhMuc = new DanhMuc { Iddanhmuc = int.Parse(Request.QueryString["id"]), Tendanhmuc = TenDanhMuc }; DanhMucDAO DAO = new DanhMucDAO(); if (DAO.SuaDanhMuc(danhMuc)) { lblThongBao.Text = "Cập nhật thành công."; } else { lblThongBao.Text = "Có lỗi trong quá trình sửa. Liên hệ DEV"; } } }
// GET: Account public ActionResult Index(bool?isLogout) { DanhMucDAO dm = new DanhMucDAO(); ViewBag.danhMuc = dm.GetAll().ToList(); if (isLogout == true) { System.Web.HttpContext.Current.Session.Clear(); } else { var userId = System.Web.HttpContext.Current.Session["USER_ID"]; if (userId != null) { var kh = db.KhachHangs.ToList().Where(item => item.userId == Convert.ToInt32(userId)).SingleOrDefault(); return(RedirectToAction("MyAccount")); } } return(View()); }
public void setViewBagForSanPham() { LoaiDAO l = new LoaiDAO(); ThuongHieuDAO th = new ThuongHieuDAO(); MauDAO m = new MauDAO(); KichCoDAO kc = new KichCoDAO(); DanhMucDAO dm = new DanhMucDAO(); ViewBag.listImage = ImageHelper.loadListImage(); //lay danh sach hinh anh ViewBag.MaLoai = l.getDanhSach(); //lay tat cac cac loai ---giai quyet ViewBag.MaThuongHieu = th.getTatCaThuongHieu(); //lay thuong hieu ViewBag.DanhSachSanPham = spDAO.layDanhSachTatCaSanPham(); //lay tat ca sp ViewBag.Mau = m.getDanhSach(); //lat tat ca mau ViewBag.KichCo = kc.getDanhSach(); //lat tat ca mau ViewBag.DanhMuc = dm.getDanhMuc(); // lấy tất cả danh mục }
public ActionResult TheLoai(int?page, int?id, string typeMaleorFemale, string categoryName, string price = "0", string filterType = "all", string size = "all", string sortOrder = "option", string sortActive = "Tùy chọn") { SanPhamDAO g = new SanPhamDAO(); DanhMucDAO dm = new DanhMucDAO(); ViewBag.danhMuc = dm.GetAll().ToList(); ViewBag.filterTypeMaleorFemale = typeMaleorFemale; ViewBag.filterType = filterType; ViewBag.action = "TheLoai"; ViewBag.price = price.ToString(); ViewBag.title = categoryName; ViewBag.size = size; ViewBag.sortActive = sortActive; ViewBag.sortOrder = sortOrder; if (id == null) { return(RedirectToAction("Index", "Home")); } int pageSize = 3; int pageNumber = page ?? 1; return(View("TheLoai", g.GetProductsBaseCategoryId(id ?? 0, typeMaleorFemale, price, filterType, size, sortOrder).ToPagedList(pageNumber, pageSize))); }
public ActionResult Register(KhachHang kh) { DanhMucDAO dm = new DanhMucDAO(); ViewBag.danhMuc = dm.GetAll().ToList(); if (ModelState.IsValid) { var khachHangDDAO = new KhachHangDAO(); var pw = Encryptor.MD5Hash(kh.password); var cfpw = Encryptor.MD5Hash(kh.confirmPassword); kh.password = pw; kh.confirmPassword = cfpw; var res = khachHangDDAO.them(kh); if (res) { ViewBag.Message = "Thêm khách hàng thành công"; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Email đã tồn tại. Vui lòng chọn email khác!"); return(View()); } return(View()); }
public void SetViewBag() { DanhMucDAO dao = new DanhMucDAO(); ViewBag.CategoryID = new SelectList(dao.ListAll(), "DanhMucID", "TenDanhMuc"); }
public void LoadDanhMuc(long?selectedId = null) { var dao = new DanhMucDAO(); ViewBag.DanhMucID = new SelectList(dao.ListAll(), "ID", "TenDanhMuc", selectedId); }
public ActionResult DropBaiViet() { var model = new DanhMucDAO().ListAll(); return(PartialView(model)); }