using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.ScoreManage; using EMIS.ViewModel.ScoreManage; using EMIS.ViewModel; using EMIS.Web.Controls; namespace EMIS.Web.Controllers.ScoreManage { [Authorization] public class LevelSettingController : Controller { public ILevelSettingServices levelSettingServices { get; set; } // public ActionResult List() { return View(); } [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var examinationSubjectID = pararms.getExtraGuid("ExaminationSubjectDropdown"); return Json(levelSettingServices.GetLevelSettingGrid(configuretView, examinationSubjectID, (int)pararms.page, (int)pararms.rows)); } public ActionResult Edit(Guid? LevelSettingID) { ViewBag.Url = Request.Url.Host; LevelSettingView levelSettingView = new LevelSettingView(); if (LevelSettingID != null && LevelSettingID != Guid.Empty) { levelSettingView = levelSettingServices.GetLevelSettingView(LevelSettingID); } ViewBag.ID = LevelSettingID; return View(levelSettingView); } [HttpPost] public ActionResult Edit(LevelSettingView levelSettingView) { try { levelSettingServices.Save(levelSettingView); return Json(new ReturnMessage() { IsSuccess = true, Message = "保存成功!" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "保存失败:" + ex.Message }); } } [HttpPost] public ActionResult Delete(string levelSettingIDs) { try { var levelSettingIDList = levelSettingIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList(); levelSettingServices.Delete(levelSettingIDList); return base.Json("删除成功"); } catch (Exception ex) { return base.Json("删除失败,原因:" + ex.Message + "!"); } } } }