public ActionResult GetBillingTerms() { // Get the Billing terms from the database var terms = _processor.GetBillingTerms(); return(View(new GridModel <BillingTerm>(terms))); }
/// <summary> /// Gets the billing terms. /// </summary> public ActionResult GetBillingTerms(JqGridParametersModel parameters) { // Get the Billing terms from the database var terms = _processor.GetBillingTerms() .OrderBy(bt => bt.BillingTermsDescription) .Skip(parameters.Rows * (parameters.Page - 1)) .Take(parameters.Rows).ToList(); var recordCount = terms.Count; return(Json( new JqJsonModel <BillingTerm>(terms) { CurrentPage = parameters.Page == 0 ? 1 : parameters.Page, RecordCount = recordCount, TotalPages = recordCount % parameters.Rows == 0 ? recordCount / parameters.Rows : (recordCount / parameters.Rows) + 1 }, JsonRequestBehavior.AllowGet )); }