LevelSettingController.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.CommonLogic.ScoreManage;
  7. using EMIS.ViewModel.ScoreManage;
  8. using EMIS.ViewModel;
  9. using EMIS.Web.Controls;
  10. namespace EMIS.Web.Controllers.ScoreManage
  11. {
  12. [Authorization]
  13. public class LevelSettingController : Controller
  14. {
  15. public ILevelSettingServices levelSettingServices { get; set; }
  16. //
  17. public ActionResult List()
  18. {
  19. return View();
  20. }
  21. [HttpPost]
  22. public ActionResult List(QueryParamsModel pararms)
  23. {
  24. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  25. var examinationSubjectID = pararms.getExtraGuid("ExaminationSubjectDropdown");
  26. return Json(levelSettingServices.GetLevelSettingGrid(configuretView, examinationSubjectID, (int)pararms.page, (int)pararms.rows));
  27. }
  28. public ActionResult Edit(Guid? LevelSettingID)
  29. {
  30. ViewBag.Url = Request.Url.Host;
  31. LevelSettingView levelSettingView = new LevelSettingView();
  32. if (LevelSettingID != null && LevelSettingID != Guid.Empty)
  33. {
  34. levelSettingView = levelSettingServices.GetLevelSettingView(LevelSettingID);
  35. }
  36. ViewBag.ID = LevelSettingID;
  37. return View(levelSettingView);
  38. }
  39. [HttpPost]
  40. public ActionResult Edit(LevelSettingView levelSettingView)
  41. {
  42. try
  43. {
  44. levelSettingServices.Save(levelSettingView);
  45. return Json(new ReturnMessage()
  46. {
  47. IsSuccess = true,
  48. Message = "保存成功!"
  49. });
  50. }
  51. catch (Exception ex)
  52. {
  53. return Json(new ReturnMessage()
  54. {
  55. IsSuccess = false,
  56. Message = "保存失败:" + ex.Message
  57. });
  58. }
  59. }
  60. [HttpPost]
  61. public ActionResult Delete(string levelSettingIDs)
  62. {
  63. try
  64. {
  65. var levelSettingIDList = levelSettingIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
  66. levelSettingServices.Delete(levelSettingIDList);
  67. return base.Json("删除成功");
  68. }
  69. catch (Exception ex)
  70. {
  71. return base.Json("删除失败,原因:" + ex.Message + "!");
  72. }
  73. }
  74. }
  75. }