using EMIS.CommonLogic; using EMIS.Utility.FormValidate; using EMIS.ViewModel; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace EMIS.Web.ServiceControllers { public class TestServicesController : Controller { public ITestServices TestServices { get; set; } public ActionResult GetTestOperateViewList() { return Json(TestServices.GetTestOperateViewList(), JsonRequestBehavior.AllowGet); } public ActionResult GetTestOperateView(Guid? operateID) { return Json(TestServices.GetTestOperateView(operateID), JsonRequestBehavior.AllowGet); } public ActionResult SaveTestOperate(TestOperateView Model, Guid UserID) { try { HttpContext.User = new CustomPrincipal() { UserID = UserID }; TestServices.Start(Model); return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功" }); } catch (Exception ex) { return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败,原因:" + ex.Message }); } } public ActionResult EndTestOperate(Guid UserID) { try { HttpContext.User = new CustomPrincipal() { UserID = UserID }; TestServices.End(UserID); return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功" }); } catch (Exception ex) { return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败,原因:" + ex.Message }); } } public ActionResult IsEnd(Guid UserID) { return Json(TestServices.IsEnd(UserID), JsonRequestBehavior.AllowGet); } } }