public JsonResult GetAllData(int rows, int page) { ChuyenMonService service = new ChuyenMonService(); List<ChuyenMonEntity> chuyenmons= new List<ChuyenMonEntity>(); try { chuyenmons= service.GetAll(); return Json(PaginationHelper<ChuyenMonEntity>.Execute(chuyenmons, page, rows), JsonRequestBehavior.AllowGet); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } return Json(null); }
// GET: ChuyenMon public ActionResult Index() { ChuyenMonService service = new ChuyenMonService(); List<ChuyenMonEntity> chuyenmons= new List<ChuyenMonEntity>(); string result = null; try { chuyenmons= service.GetAll(); result = JsonConvert.SerializeObject(chuyenmons); RenderResult.RequestCompleted(ViewData, result); } catch (Exception e) { System.Console.WriteLine(e.ToString()); RenderResult.RequestError(ViewData, "Lỗi hệ thống"); } return View(); }
public JsonResult GetMaQuyDinh() { ChuyenMonService service = new ChuyenMonService(); try { return Json(RenderResult.RequestCompleted(ViewData, GenKey.GenIncrementKey("CM", 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); } }