NoticeController.cs 3.3 KB

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