public ActionResult List(int page, int rows, string sidx, string sord) { var poll = new PollService().List(); bool searchOn = bool.Parse(Request.Form["_search"]); string searchExp = ""; if (searchOn) { searchExp = string.Format("{0}.ToString().Contains(@0)", getFormValue("searchField")); poll = poll.Where(searchExp, new string[] { getFormValue("searchString") }); } var model = from entity in poll.OrderBy(sidx + " " + sord) select new { Id = entity.Id, PollName = entity.PollName, Status = entity.Status }; return Json(model.ToJqGridData(page, rows, null, "", new[] { "PollName", "Status" }), JsonRequestBehavior.AllowGet); }
public PublicPollViewData(int id) { ActivePoll = new PollService().GetItem(id); Questions = new PollQuestionService().GetQuestionByPoll(ActivePoll); Calculate(); }