TestServicesController.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using EMIS.CommonLogic;
  2. using EMIS.Utility.FormValidate;
  3. using EMIS.ViewModel;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.Mvc;
  9. namespace EMIS.Web.ServiceControllers
  10. {
  11. public class TestServicesController : Controller
  12. {
  13. public ITestServices TestServices { get; set; }
  14. public ActionResult GetTestOperateViewList()
  15. {
  16. return Json(TestServices.GetTestOperateViewList(), JsonRequestBehavior.AllowGet);
  17. }
  18. public ActionResult GetTestOperateView(Guid? operateID)
  19. {
  20. return Json(TestServices.GetTestOperateView(operateID), JsonRequestBehavior.AllowGet);
  21. }
  22. public ActionResult SaveTestOperate(TestOperateView Model, Guid UserID)
  23. {
  24. try
  25. {
  26. HttpContext.User = new CustomPrincipal() { UserID = UserID };
  27. TestServices.Start(Model);
  28. return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功" });
  29. }
  30. catch (Exception ex)
  31. {
  32. return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败,原因:" + ex.Message });
  33. }
  34. }
  35. public ActionResult EndTestOperate(Guid UserID)
  36. {
  37. try
  38. {
  39. HttpContext.User = new CustomPrincipal() { UserID = UserID };
  40. TestServices.End(UserID);
  41. return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功" });
  42. }
  43. catch (Exception ex)
  44. {
  45. return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败,原因:" + ex.Message });
  46. }
  47. }
  48. public ActionResult IsEnd(Guid UserID)
  49. {
  50. return Json(TestServices.IsEnd(UserID), JsonRequestBehavior.AllowGet);
  51. }
  52. }
  53. }