public IActionResult PolicyList() { try { var formCollection = Request.Form; var searchModel = new PolicySearchModel(); if (!string.IsNullOrWhiteSpace(formCollection["pagination[page]"])) { searchModel.Page = int.Parse(formCollection["pagination[page]"]); } if (!string.IsNullOrWhiteSpace(formCollection["pagination[pages]"])) { searchModel.Pages = int.Parse(formCollection["pagination[pages]"]); } if (!string.IsNullOrWhiteSpace(formCollection["pagination[perpage]"])) { var pageSize = int.Parse(formCollection["pagination[perpage]"]); searchModel.Perpage = pageSize > 0 ? pageSize : 10; } if (!string.IsNullOrWhiteSpace(formCollection["pagination[total]"])) { searchModel.Total = int.Parse(formCollection["pagination[total]"]); } if (!string.IsNullOrWhiteSpace(formCollection["sort[field]"])) { searchModel.Field = formCollection["sort[field]"]; } if (!string.IsNullOrWhiteSpace(formCollection["sort[sort]"])) { searchModel.Sort = formCollection["sort[sort]"]; } if (!string.IsNullOrWhiteSpace(formCollection["query[policySearch]"])) { searchModel.Query = formCollection["query[policySearch]"]; } var model = _listFactory.PreparePolicyListModel(searchModel); return(Json(model)); } catch (Exception ex) { } return(Json(new PolicyListModel())); }