Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. public JsonResult IndexJson(BootgridRequestData model)
  2. {
  3. var contacts = (from x in db.ContactSet
  4. select new
  5. {
  6. x.AccountId,
  7. x.FirstName,
  8. x.LastName,
  9. x.FullName,
  10. x.JobTitle,
  11. x.ParentCustomerId,
  12. x.EMailAddress1,
  13. x.Telephone1,
  14. x.MobilePhone,
  15. x.Fax,
  16. x.GenderCode,
  17. x.BirthDate
  18. }).ToList();
  19.  
  20. // This tResult throws a Non-invocable member cannot be used like a method error.
  21. var tResult = BootgridResponseData<JsonResult>() {
  22. current = model.current,
  23. rowCount = model.rowCount,
  24. rows = contacts,
  25. total = contacts.Count
  26. };
  27.  
  28. return Json(tResult, JsonRequestBehavior.AllowGet);
  29. }
  30.  
  31. public class BootgridRequestData
  32. {
  33. public int current { get; set; }
  34. public string rowCount { get; set; }
  35. public string searchPhrase { get; set; }
  36. public IEnumerable<SortData> sortItems { get; set; }
  37. }
  38.  
  39. public class BootgridResponseData<T> where T : class
  40. {
  41. public int current { get; set; } //? current page
  42. public int rowCount { get; set; } //? rows per page
  43. public IEnumerable<T> rows { get; set; } //? items
  44. public int total { get; set; } //? total rows for whole query
  45. }
  46.  
  47. public class SortData
  48. {
  49. public string Field { get; set; } //? Field Name
  50. public string Type { get; set; } //? ASC or DESC
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement