public ActionResult _partialSkillsResultList() { oriondbEntities db = new oriondbEntities(); string spExecute = "sp_skillsList @PageNumber = 1 ,@filterbyCreatedDateORmodifiedDate = true"; var result = db.Database.SqlQuery <sp_skillsList_Result>(spExecute).ToList(); sp_skillsList_Result sp = new sp_skillsList_Result(); double pageCount = Convert.ToDouble(result[1].total / 2); sp.PageCount = (int)Math.Ceiling(pageCount); sp.CurrentPageIndex = 1; ViewBag.count = pageCount; ViewBag.data = "Yes"; ViewBag.currindex = sp.CurrentPageIndex; return(PartialView(result)); }
public ActionResult skillsResultList(int currentPageIndex, FormCollection frm) { oriondbEntities db = new oriondbEntities(); string spExecute = "sp_skillsList @PageNumber =" + currentPageIndex + ","; if (frm["frm[radio0]"] != null) { spExecute += "@filterbyCreatedDateORmodifiedDate =" + frm["frm[radio0]"] + ","; } else { spExecute += "@filterbyCreatedDateORmodifiedDate = 1 ,"; } if (frm["frm[name]"] != "") { spExecute += "@skillName = '" + frm["frm[name]"] + "',"; } else { spExecute += "@skillName = null , "; } if (frm["frm[isActive]"] != null) { spExecute += "@isActive = " + frm["frm[isActive]"] + ""; } else { spExecute += "@isActive = 1 "; } var result = db.Database.SqlQuery <sp_skillsList_Result>(spExecute).ToList(); sp_skillsList_Result sp = new sp_skillsList_Result(); double pageCount; if (result.Count == 1) { pageCount = Convert.ToDouble(result.Count); sp.PageCount = (int)Math.Ceiling(pageCount); sp.PageCount = Convert.ToInt32(pageCount); sp.CurrentPageIndex = currentPageIndex; ViewBag.count = pageCount; ViewBag.data = "Yes"; ViewBag.currindex = currentPageIndex; } else if (result.Count > 1) { pageCount = Convert.ToDouble((result.Count) / 2); sp.PageCount = (int)Math.Ceiling(pageCount); sp.PageCount = Convert.ToInt32(pageCount); sp.CurrentPageIndex = currentPageIndex; ViewBag.count = pageCount; ViewBag.data = "Yes"; ViewBag.currindex = currentPageIndex; } else { ViewBag.data = "Nodata"; } return(PartialView("_partialSkillsResultList", result)); }