SupervisionUserController.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.ViewModel;
  7. using EMIS.CommonLogic.SupervisionManage;
  8. using EMIS.ViewModel.SupervisionManage;
  9. using EMIS.Web.Controls;
  10. namespace EMIS.Web.Controllers.SupervisionManage
  11. {
  12. [Authorization]
  13. public class SupervisionUserController : Controller
  14. {
  15. public ISupervisionUserServices supervisionUserServices { get; set; }
  16. public ActionResult List()
  17. {
  18. return View();
  19. }
  20. [HttpPost]
  21. public ActionResult List(QueryParamsModel pararms)
  22. {
  23. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  24. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  25. return base.Json(supervisionUserServices.GetSupervisionUserGrid(configuretView, collegeID, (int)pararms.page, (int)pararms.rows));
  26. }
  27. [HttpGet]
  28. public ActionResult Edit(Guid? supervisionUserID)
  29. {
  30. ProjectRecordTeacherView projectRecordTeacherView = new ProjectRecordTeacherView();
  31. if (supervisionUserID.HasValue && supervisionUserID != Guid.Empty)
  32. {
  33. projectRecordTeacherView = supervisionUserServices.GetProjectRecordTeacherView(supervisionUserID);
  34. }
  35. return View(projectRecordTeacherView);
  36. }
  37. /// <summary>
  38. /// 编辑
  39. /// </summary>
  40. /// <param name="graduationConditionView"></param>
  41. /// <returns></returns>
  42. [HttpPost]
  43. public ActionResult Edit(ProjectRecordTeacherView projectRecordTeacherView)
  44. {
  45. try
  46. {
  47. supervisionUserServices.Save(projectRecordTeacherView);
  48. return Json(new ReturnMessage()
  49. {
  50. IsSuccess = true,
  51. Message = "保存成功。"
  52. });
  53. }
  54. catch (Exception ex)
  55. {
  56. return Json(new ReturnMessage()
  57. {
  58. IsSuccess = false,
  59. Message = "保存失败,原因:" + ex.Message + "。"
  60. });
  61. }
  62. }
  63. [HttpPost]
  64. public ActionResult Delete(string supervisionUserIDs)
  65. {
  66. try
  67. {
  68. var supervisionUserIDList = supervisionUserIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  69. supervisionUserServices.Delete(supervisionUserIDList);
  70. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功" });
  71. }
  72. catch (Exception ex)
  73. {
  74. return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败,原因:" + ex.Message });
  75. }
  76. }
  77. }
  78. }