public ActionResult AdvanceSearch(FormCollection form) { SearchModel search = new SearchModel(); search.Ten = form["TEN"]; if (form["NHASANXUAT"].ToString() != "0") search.NhaSanSuat = form["NHASANXUAT"]; else search.NhaSanSuat = ""; if (form["LOAISANPHAM"].ToString() != "0") search.LoaiSanPham = form["LOAISANPHAM"]; else { search.LoaiSanPham = ""; } search.GiaToiThieu = searchcode.TinhGiaToiThieu(form["GiaBan"]); search.GiaToiDa = searchcode.TinhGiaToiDa(form["GiaBan"]); if (form["KHUYENMAI"] == "false") search.KhuyenMai = false; else search.KhuyenMai = true; if (form["BANCHAY"] == "false") search.SPBanChay = false; else search.SPBanChay = true; TempData["Advance_search"] = search; return RedirectToAction("Index", "Product", new { name = "AdvanceSearch", id = -1 }); }
public ProductList SearchAdvance(SearchModel search) { ProductList list = new ProductList(); c.BaseAddress = new Uri(url); c.DefaultRequestHeaders.Accept.Clear(); c.DefaultRequestHeaders.Accept.Add( new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json") ); HttpResponseMessage response = c.PostAsJsonAsync( "api/product/SearchAdvance",search).Result; list = response.Content.ReadAsAsync<ProductList>().Result; list.newPageList = list.newList.ToPagedList(1, 20); return list; }