You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

101 lines
3.1 KiB

  1. using Learun.Application.OA;
  2. using Learun.Util;
  3. using System.Web.Mvc;
  4. namespace Learun.Application.Web.Areas.LR_OAModule.Controllers
  5. {
  6. /// <summary>
  7. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  8. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  9. /// 创建人:陈彬彬
  10. /// 日 期:2017.04.01
  11. /// 描 述:新闻管理
  12. /// </summary>
  13. public class NewsController : MvcControllerBase
  14. {
  15. private NewsIBLL newsIBLL = new NewsBLL();
  16. #region 视图功能
  17. /// <summary>
  18. /// 管理页面
  19. /// </summary>
  20. /// <returns></returns>
  21. [HttpGet]
  22. public ActionResult Index()
  23. {
  24. return View();
  25. }
  26. /// <summary>
  27. /// 表单页面
  28. /// </summary>
  29. /// <returns></returns>
  30. [HttpGet]
  31. public ActionResult Form()
  32. {
  33. return View();
  34. }
  35. #endregion
  36. #region 获取数据
  37. /// <summary>
  38. /// 获取分页数据
  39. /// </summary>
  40. /// <param name="pagination">分页参数</param>
  41. /// <param name="categoryId">类型</param>
  42. /// <param name="keyword">关键词</param>
  43. /// <returns></returns>
  44. public ActionResult GetPageList(string pagination, string keyword)
  45. {
  46. Pagination paginationobj = pagination.ToObject<Pagination>();
  47. var data = newsIBLL.GetPageList(paginationobj, keyword);
  48. var jsonData = new
  49. {
  50. rows = data,
  51. total = paginationobj.total,
  52. page = paginationobj.page,
  53. records = paginationobj.records,
  54. };
  55. return JsonResult(jsonData);
  56. }
  57. /// <summary>
  58. /// 获取实体数据
  59. /// </summary>
  60. /// <param name="keyValue">主键</param>
  61. /// <returns></returns>
  62. public ActionResult GetEntity(string keyValue)
  63. {
  64. var data = newsIBLL.GetEntity(keyValue);
  65. data.F_NewsContent = WebHelper.HtmlDecode(data.F_NewsContent);
  66. return JsonResult(data);
  67. }
  68. #endregion
  69. #region 提交数据
  70. /// <summary>
  71. /// 保存表单数据
  72. /// </summary>
  73. /// <param name="keyValue">主键</param>
  74. /// <param name="entity">实体</param>
  75. /// <returns></returns>
  76. [HttpPost, ValidateAntiForgeryToken, AjaxOnly, ValidateInput(false)]
  77. public ActionResult SaveForm(string keyValue, NewsEntity entity)
  78. {
  79. entity.F_NewsContent = WebHelper.HtmlEncode(entity.F_NewsContent);
  80. newsIBLL.SaveEntity(keyValue, entity);
  81. return Success("保存成功!");
  82. }
  83. /// <summary>
  84. /// 删除表单数据
  85. /// </summary>
  86. /// <param name="keyValue">主键</param>
  87. /// <returns></returns>
  88. [HttpPost]
  89. [AjaxOnly]
  90. public ActionResult DeleteForm(string keyValue)
  91. {
  92. newsIBLL.DeleteEntity(keyValue);
  93. return Success("删除成功!");
  94. }
  95. #endregion
  96. }
  97. }