public ActionResult Delete(int index, int id) { var model = new TaxCodeListModel(); model.GridIndex = index; try { LookupService.DeleteTaxCode(id); } catch (Exception e1) { model.Error.SetError(e1); } return(Json(model, JsonRequestBehavior.AllowGet)); }
public TaxCodeListModel FindTaxCodesListModel(int companyId, int index, int pageNo, int pageSize, string search) { var model = new TaxCodeListModel(); // Do a case-insensitive search model.GridIndex = index; var allItems = db.FindTaxCodes(companyId, true) .Where(tc => string.IsNullOrEmpty(search) || (tc.TaxCode1 != null && tc.TaxCode1.ToLower().Contains(search.ToLower())) || (tc.TaxCodeDescription != null && tc.TaxCodeDescription.ToLower().Contains(search.ToLower())) || (tc.TaxCodeTypeId != null && tc.TaxCodeTypeId.ToLower().Contains(search.ToLower()))); model.TotalRecords = allItems.Count(); foreach (var item in allItems.Skip((pageNo - 1) * pageSize) .Take(pageSize)) { model.Items.Add(MapToModel(item)); } return(model); }