NoticeController.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. using LeaRun.Application.Busines.PublicInfoManage;
  2. using LeaRun.Application.Code;
  3. using LeaRun.Application.Entity.PublicInfoManage;
  4. using LeaRun.Util;
  5. using LeaRun.Util.WebControl;
  6. using System.Web.Mvc;
  7. namespace LeaRun.Application.Web.Areas.PublicInfoManage.Controllers
  8. {
  9. /// <summary>
  10. /// 版 本 6.1
  11. /// Copyright (c) 2013-2016 上海力软信息技术有限公司
  12. /// 创建人:佘赐雄
  13. /// 日 期:2015.12.7 16:40
  14. /// 描 述:电子公告
  15. /// </summary>
  16. public class NoticeController : MvcControllerBase
  17. {
  18. private NoticeBLL noticeBLL = new NoticeBLL();
  19. #region 视图功能
  20. /// <summary>
  21. /// 公告管理
  22. /// </summary>
  23. /// <returns></returns>
  24. [HttpGet]
  25. [HandlerAuthorize(PermissionMode.Enforce)]
  26. public ActionResult Index()
  27. {
  28. return View();
  29. }
  30. /// <summary>
  31. /// 公告表单
  32. /// </summary>
  33. /// <returns></returns>
  34. [HttpGet]
  35. [HandlerAuthorize(PermissionMode.Enforce)]
  36. public ActionResult Form()
  37. {
  38. return View();
  39. }
  40. #endregion
  41. #region 获取数据
  42. /// <summary>
  43. /// 公告列表
  44. /// </summary>
  45. /// <param name="pagination">分页参数</param>
  46. /// <param name="queryJson">查询参数</param>
  47. /// <returns>返回分页列表Json</returns>
  48. [HttpGet]
  49. public ActionResult GetPageListJson(Pagination pagination, string queryJson)
  50. {
  51. var watch = CommonHelper.TimerStart();
  52. var data = noticeBLL.GetPageList(pagination, queryJson);
  53. var JsonData = new
  54. {
  55. rows = data,
  56. total = pagination.total,
  57. page = pagination.page,
  58. records = pagination.records,
  59. costtime = CommonHelper.TimerEnd(watch)
  60. };
  61. return Content(JsonData.ToJson());
  62. }
  63. /// <summary>
  64. /// 公告实体
  65. /// </summary>
  66. /// <param name="keyValue">主键值</param>
  67. /// <returns>返回对象Json</returns>
  68. [HttpGet]
  69. public ActionResult GetFormJson(string keyValue)
  70. {
  71. var data = noticeBLL.GetEntity(keyValue);
  72. return ToJsonResult(data);
  73. }
  74. #endregion
  75. #region 提交数据
  76. /// <summary>
  77. /// 删除公告
  78. /// </summary>
  79. /// <param name="keyValue">主键值</param>
  80. /// <returns></returns>
  81. [HttpPost]
  82. [ValidateAntiForgeryToken]
  83. [AjaxOnly]
  84. [HandlerAuthorize(PermissionMode.Enforce)]
  85. public ActionResult RemoveForm(string keyValue)
  86. {
  87. noticeBLL.RemoveForm(keyValue);
  88. return Success("删除成功。");
  89. }
  90. /// <summary>
  91. /// 保存公告表单(新增、修改)
  92. /// </summary>
  93. /// <param name="keyValue">主键值</param>
  94. /// <param name="newsEntity">公告实体</param>
  95. /// <returns></returns>
  96. [HttpPost]
  97. [AjaxOnly]
  98. [ValidateInput(false)]
  99. public ActionResult SaveForm(string keyValue, NewsEntity newsEntity)
  100. {
  101. noticeBLL.SaveForm(keyValue, newsEntity);
  102. return Success("操作成功。");
  103. }
  104. #endregion
  105. }
  106. }