public JsonResult GetAllData(int rows, int page) { DonViService service = new DonViService(); List<DonViEntity> donvis = new List<DonViEntity>(); try { donvis = service.GetAll(); return Json(PaginationHelper<DonViEntity>.Execute(donvis, page, rows), JsonRequestBehavior.AllowGet); } catch(Exception e) { System.Console.WriteLine(e.ToString()); } return Json(null); }
// GET: DonVi public ActionResult Index() { DonViService service = new DonViService(); List<DonViEntity> donvis = new List<DonViEntity>(); string result = null; try { donvis = service.GetAll(); result = JsonConvert.SerializeObject(donvis); 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() { DonViService service = new DonViService(); try { return Json(RenderResult.RequestCompleted(ViewData, GenKey.GenIncrementKey("DV", 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); } }
public JsonResult GetAllIdDonVi() { string result = null; DonViService service = new DonViService(); List<DonViEntity> dvEntity = new List<DonViEntity>(); try { dvEntity = service.GetAll(); result = JsonConvert.SerializeObject(dvEntity); return Json(dvEntity, JsonRequestBehavior.AllowGet); } catch (Exception e) { System.Console.WriteLine(e.ToString()); return Json(null); } }