public ActionResult Contact(LienHe model) { if (ModelState.IsValid) { var home = new HomeProcess(); var lh = new LienHe(); //gán dữ liệu từ client vào model lh.Ten = model.Ten; lh.Ho = model.Ho; lh.Email = model.Email; lh.DienThoai = model.DienThoai; lh.NoiDung = model.NoiDung; lh.NgayCapNhat = DateTime.Now; //gọi hàm lưu thông tin phản hồi từ khách hàng var result = home.InsertContact(lh); if (result > 0) { ViewBag.success = "Đã ghi nhận phản hồi của bạn"; ModelState.Clear(); return(View()); } else { ModelState.AddModelError("", "Lỗi ghi nhận"); } } return(View(model)); }
//GET : /Home/ShowCategory : hiển thị danh mục phía bên trái trang chủ //Parital View : Showcategory public ActionResult ShowCategory() { //gọi hàm xuất danh sách thể loại var result = new HomeProcess().ListCategory(); return(PartialView(result)); }
public ActionResult SearchResult(int?page, string key) { ViewBag.Key = key; //phân trang int pageNumber = (page ?? 1); int pageSize = 6; var result = new HomeProcess().Search(key).ToPagedList(pageNumber, pageSize); if (result.Count == 0 || key == null || key == "") { ViewBag.ThongBao = "Không tìm thấy sản phẩm nào"; return(View(result)); } ViewBag.ThongBao = "Hiện có " + result.Count + " kết quả ở trang này"; return(View(result)); }
public ActionResult SearchResult(int?page, FormCollection f) { //gán từ khóa tìm kiếm được nhập từ client string key = f["txtSearch"].ToString(); ViewBag.Key = key; //phân trang int pageNumber = (page ?? 1); int pageSize = 6; var result = new HomeProcess().Search(key).ToPagedList(pageNumber, pageSize); if (result.Count == 0 || key == null || key == "") { ViewBag.ThongBao = "Không tìm thấy sản phẩm nào"; return(View(result)); } ViewBag.ThongBao = "Hiện có " + result.Count + " kết quả ở trang này"; return(View(result)); }