Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public JsonResult IndexJson(BootgridRequestData model)
- {
- var contacts = (from x in db.ContactSet
- select new
- {
- x.AccountId,
- x.FirstName,
- x.LastName,
- x.FullName,
- x.JobTitle,
- x.ParentCustomerId,
- x.EMailAddress1,
- x.Telephone1,
- x.MobilePhone,
- x.Fax,
- x.GenderCode,
- x.BirthDate
- }).ToList();
- // This tResult throws a Non-invocable member cannot be used like a method error.
- var tResult = BootgridResponseData<JsonResult>() {
- current = model.current,
- rowCount = model.rowCount,
- rows = contacts,
- total = contacts.Count
- };
- return Json(tResult, JsonRequestBehavior.AllowGet);
- }
- public class BootgridRequestData
- {
- public int current { get; set; }
- public string rowCount { get; set; }
- public string searchPhrase { get; set; }
- public IEnumerable<SortData> sortItems { get; set; }
- }
- public class BootgridResponseData<T> where T : class
- {
- public int current { get; set; } //? current page
- public int rowCount { get; set; } //? rows per page
- public IEnumerable<T> rows { get; set; } //? items
- public int total { get; set; } //? total rows for whole query
- }
- public class SortData
- {
- public string Field { get; set; } //? Field Name
- public string Type { get; set; } //? ASC or DESC
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement