Пример #1
0
        public ActionResult AjaxHandler(jQueryDataTableParamModel param)
        {
            var allContacts = _contactService.GetAll().ToList();
            var displayedCompanies = _contactService.GetPagedContacts(
               param.iDisplayStart, param.iDisplayLength, param.sSearch);

            var result = from c in displayedCompanies
                         select new[] { c.FirstName, c.LastName, c.Street, c.PhoneNumber, c.ZipLocation.City };

            return Json(new
            {
                sEcho = param.sEcho,
                iTotalRecords = allContacts.Count(),
                iTotalDisplayRecords = allContacts.Count(),
                aaData = result
            },
                                JsonRequestBehavior.AllowGet);
        }
Пример #2
0
        public ActionResult AjaxHandler(jQueryDataTableParamModel param)
        {
            var allContacts = _contactService.GetAll().ToList();
             var displayedCompanies = _contactService.GetPagedContacts(
            param.iDisplayStart, param.iDisplayLength, param.sSearch);

             var result = from c in displayedCompanies
                      select new[] { c.FirstName.ToString(), c.LastName.ToString(), c.UserName, c.Password, c.Street, c.PhoneNumber, c.ZipLocation.City.ToString(), c.RoleName, "<a style='font-family:arial' href='" + "/Admin/Edit/ " + c.UserId + "' />Edit</a>|<a style='font-family:arial' href='" + "/Admin/Delete/" + c.UserId + "' />Delete</a>" };

             return Json(new
             {
            sEcho = param.sEcho,
            iTotalRecords = allContacts.Count(),
            iTotalDisplayRecords = allContacts.Count(),
            aaData = result
             },
                             JsonRequestBehavior.AllowGet);
        }