// GET: /Jobs/ public ActionResult Index(int? page, jobsbyPaging jp) { int currentPageIndex = page.HasValue ? page.Value : 1; string criteria = ""; criteria = "joblistn.isApproved = 'Y' "; System.Data.Entity.Core.Objects.ObjectParameter Count = new System.Data.Entity.Core.Objects.ObjectParameter("Count", typeof(int)); // output = 0; jp.data = db.jobbySearchnpage(currentPageIndex, defaultPageSize, criteria, Count).ToList(); jp.pagesize = defaultPageSize; jp.TotalCount = Convert.ToInt64(Count.Value); return View(jp); }
public ActionResult SearchJobs(int? page, jobsbyPaging jp) { int currentPageIndex = page.HasValue ? page.Value : 1; string criteria = ""; string country = ""; string city = ""; string state = ""; string category = ""; if (jp.countryid > 0) { country = " AND joblistn.countryid=" + jp.countryid; } if (jp.stateid > 0) { state = " AND joblistn.stateid=" + jp.stateid; } if (jp.cityid > 0) { city = " AND joblistn.cityid=" + jp.cityid; } if (jp.jobcategoryid > 0) { category = " AND joblistn.jobcategoryid=" + jp.jobcategoryid; } criteria = "joblistn.isApproved = 'Y' " + city + country + state + category ; System.Data.Entity.Core.Objects.ObjectParameter Count = new System.Data.Entity.Core.Objects.ObjectParameter("Count", typeof(int)); // output = 0; jp.data = db.jobbySearchnpage(currentPageIndex, defaultPageSize, criteria, Count).ToList(); jp.pagesize = defaultPageSize; jp.TotalCount = Convert.ToInt64(Count.Value); // members = mm.OrderByDescending(p => p.pid).ToPagedList(currentPageIndex, defaultPageSize); ViewBag.cityid = new SelectList(db.citytables, "cityid", "cityname", ViewData["cityid"]); ViewBag.countryid = new SelectList(db.Countries, "COUNTRYID", "countryname", ViewData["countryid"]); ViewBag.stateid = new SelectList(db.states, "stateid", "statename", ViewData["stateid"]); ViewBag.jobcategoryid = new SelectList(db.jobcategories, "jobcategoryid", "category"); return View(jp); }