public JsonResult GetAllData(int rows, int page) { ThanhTichServices service = new ThanhTichServices(); List<ThanhTichEntity> thanhTichs = new List<ThanhTichEntity>(); try { thanhTichs = service.GetAll(); return Json(PaginationHelper<ThanhTichEntity>.Execute(thanhTichs, page, rows), JsonRequestBehavior.AllowGet); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } return Json(null); }
// GET: ThanhTich public ActionResult Index() { ThanhTichServices service = new ThanhTichServices(); List<ThanhTichEntity> thanhTichs = new List<ThanhTichEntity>(); string result = null; try { thanhTichs = service.GetAll(); result = JsonConvert.SerializeObject(thanhTichs); RenderResult.RequestCompleted(ViewData, result); } catch (Exception e) { System.Console.WriteLine(e.ToString()); RenderResult.RequestError(ViewData, "Lỗi hệ thống"); } return View(); }
public JsonResult GetSo() { ThanhTichServices service = new ThanhTichServices(); try { return Json(RenderResult.RequestCompleted(ViewData, GenKey.GenIncrementKey("TT", 3, service.GetAll().Count)), JsonRequestBehavior.AllowGet); } catch (Exception e) { System.Console.WriteLine(e.ToString()); return Json(RenderResult.RequestError(ViewData, "Lỗi xảy ra"), JsonRequestBehavior.AllowGet); } }