public static object GetByFilter(SessionInfo sessioninfo, string label, int jtStartIndex, int jtPageSize, string jtSorting) { try { CountryBusiness _countryBusiness = new CountryBusiness(); //Get data from database List <MA_COUNTRY> countries = _countryBusiness.GetByFilter(sessioninfo, label, jtSorting); //Return result to jTable return(new { Result = "OK", Records = jtPageSize > 0 ? countries.Skip(jtStartIndex).Take(jtPageSize).ToList() : countries, TotalRecordCount = countries.Count }); } catch (BusinessWorkflowsException bex) { return(new { Result = "ERROR", Message = bex.Message }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }