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.
 
 
 
 
 
 

116 lines
3.4 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using Learun.Application.TwoDevelopment.EducationalAdministration;
  6. using Learun.Util;
  7. using Nancy;
  8. namespace Learun.Application.WebApi.Modules
  9. {
  10. public class StuEnrollApi : BaseApi
  11. {
  12. public StuEnrollApi()
  13. : base("/learun/adms/StuEnroll")
  14. {
  15. Get["/pagelist"] = GetPageList;
  16. Get["/list"] = GetList;
  17. Get["/form"] = GetForm;
  18. Post["/delete"] = DeleteForm;
  19. Post["/save"] = SaveForm;
  20. }
  21. private StuEnrollIBLL stuEnrollIBLL = new StuEnrollBLL();
  22. #region 获取数据
  23. /// <summary>
  24. /// 获取页面显示列表分页数据
  25. /// <summary>
  26. /// <param name="_"></param>
  27. /// <returns></returns>
  28. public Response GetPageList(dynamic _)
  29. {
  30. ReqPageParam parameter = this.GetReqData<ReqPageParam>();
  31. var data = stuEnrollIBLL.GetPageList(parameter.pagination, parameter.queryJson);
  32. var jsonData = new
  33. {
  34. rows = data,
  35. total = parameter.pagination.total,
  36. page = parameter.pagination.page,
  37. records = parameter.pagination.records
  38. };
  39. return Success(jsonData);
  40. }
  41. /// <summary>
  42. /// 获取页面显示列表数据
  43. /// <summary>
  44. /// <param name="_"></param>
  45. /// <returns></returns>
  46. public Response GetList(dynamic _)
  47. {
  48. string queryJson = this.GetReqData();
  49. var data = stuEnrollIBLL.GetList(queryJson);
  50. return Success(data);
  51. }
  52. /// <summary>
  53. /// 获取表单数据
  54. /// <summary>
  55. /// <param name="_"></param>
  56. /// <returns></returns>
  57. public Response GetForm(dynamic _)
  58. {
  59. string keyValue = this.GetReqData();
  60. var StuEnrollData = stuEnrollIBLL.GetStuEnrollEntity(keyValue);
  61. var jsonData = new
  62. {
  63. StuEnroll = StuEnrollData,
  64. };
  65. return Success(jsonData);
  66. }
  67. #endregion
  68. #region 提交数据
  69. /// <summary>
  70. /// 删除实体数据
  71. /// <param name="_"></param>
  72. /// <summary>
  73. /// <returns></returns>
  74. public Response DeleteForm(dynamic _)
  75. {
  76. string keyValue = this.GetReqData();
  77. stuEnrollIBLL.DeleteEntity(keyValue);
  78. return Success("删除成功!");
  79. }
  80. /// <summary>
  81. /// 保存实体数据(新增、修改)
  82. /// <param name="_"></param>
  83. /// <summary>
  84. /// <returns></returns>
  85. public Response SaveForm(dynamic _)
  86. {
  87. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  88. StuEnrollEntity entity = parameter.strEntity.ToObject<StuEnrollEntity>();
  89. stuEnrollIBLL.SaveEntity( parameter.keyValue,entity);
  90. return Success("保存成功!");
  91. }
  92. #endregion
  93. #region 私有类
  94. /// <summary>
  95. /// 表单实体类
  96. /// <summary>
  97. private class ReqFormEntity
  98. {
  99. public string keyValue { get; set; }
  100. public string strEntity { get; set; }
  101. public string EmpNo { get; set; }
  102. }
  103. #endregion
  104. }
  105. }