ExamSettingController.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMISOnline.CommonLogic.ExamServices;
  7. using EMISOnline.ViewModel.ExamView;
  8. using EMISOnline.ViewModel;
  9. namespace EMISOnline.Web.Controllers.Manage
  10. {
  11. [Authorization]
  12. public class ExamSettingController : Controller
  13. {
  14. public IExamSettingServices IExamSettingService { get; set; }
  15. //
  16. // GET: /ExamSetting/
  17. public ActionResult ExamList()
  18. {
  19. return View();
  20. }
  21. /// <summary>
  22. /// 列表查询
  23. /// </summary>
  24. /// <param name="pararms"></param>
  25. /// <returns></returns>
  26. [HttpPost]
  27. public ActionResult List(string testname, int page, int rows)
  28. {
  29. var result = IExamSettingService.GetOnlinetestList(testname,page, rows);
  30. return Json(result);
  31. }
  32. public ActionResult ExamAdd(decimal? test_id)
  33. {
  34. OnlineTestView view = new OnlineTestView();
  35. if (test_id.HasValue)
  36. {
  37. view = IExamSettingService.GetOnlineTestByID(test_id.Value);
  38. }
  39. return View(view);
  40. }
  41. [HttpPost]
  42. public ActionResult ExamAdd(OnlineTestView OnlineTestView)
  43. {
  44. try
  45. {
  46. var user = ((EMISOnline.Utility.FormValidate.CustomPrincipal)HttpContext.User);
  47. IExamSettingService.ExamSettingSave(OnlineTestView, user.LoginID);
  48. return Json(new ReturnMessage()
  49. {
  50. IsSuccess = true,
  51. Message = "保存成功!",
  52. RedictUrl = Url.Content("~/ExamSetting/ExamList")
  53. });
  54. }
  55. catch (Exception ex)
  56. {
  57. return Json(new ReturnMessage()
  58. {
  59. IsSuccess = false,
  60. Message = "保存失败:" + ex.Message
  61. });
  62. }
  63. }
  64. [HttpPost]
  65. public ActionResult GetPaperList(string PaperName, int page, int rows)
  66. {
  67. var result = IExamSettingService.GetPaperList(PaperName, page-1, rows);
  68. return Json(result);
  69. }
  70. }
  71. }