public ActionResult Index2(string searchString, int?page, int?pageSize) { var obj = new ScheduleDetailActivityCategoryDataModel(); obj.Name = searchString; var list = ScheduleDetailActivityCategoryDataManager.GetEntityDetails(obj, SessionVariables.RequestProfile); if (pageSize.HasValue) { SessionVariables.DefaultRowCount = pageSize.Value; } int pageNumber = (page - 1 ?? 0); ViewBag.searchString = searchString; ViewBag.CurrentPage = list.Count > 0 ? pageNumber + 1 : 0; ViewBag.TotalPages = list.Count / SessionVariables.DefaultRowCount; if (list.Count % SessionVariables.DefaultRowCount != 0) { ViewBag.TotalPages = (list.Count / SessionVariables.DefaultRowCount) + 1; } list = list.Count > 0 ? list.Skip(pageNumber * SessionVariables.DefaultRowCount).Take(SessionVariables.DefaultRowCount).ToList() : list; return(View(list)); }
public JsonResult IndexResult(string name, int?page, int?pageSize) { var obj = new ScheduleDetailActivityCategoryDataModel(); obj.Name = name; var list = ScheduleDetailActivityCategoryDataManager.GetEntityDetails(obj, SessionVariables.RequestProfile); return(Json(list, JsonRequestBehavior.AllowGet)); }
public ScheduleDetailActivityCategoryDataModel GetById(int id) { var obj = new ScheduleDetailActivityCategoryDataModel(); obj.ScheduleDetailActivityCategoryId = id; var list = ScheduleDetailActivityCategoryDataManager.GetEntityDetails(obj, SessionVariables.RequestProfile); if (list == null || list.Count == 0) { return(null); } return(list[0]); }