using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EMIS.ViewModel;
using EMIS.CommonLogic.SupervisionManage;
using EMIS.ViewModel.SupervisionManage;
using EMIS.Web.Controls;
namespace EMIS.Web.Controllers.SupervisionManage
{
[Authorization]
public class SupervisionUserController : Controller
{
public ISupervisionUserServices supervisionUserServices { get; set; }
public ActionResult List()
{
return View();
}
[HttpPost]
public ActionResult List(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var collegeID = pararms.getExtraGuid("CollegeDropdown");
return base.Json(supervisionUserServices.GetSupervisionUserGrid(configuretView, collegeID, (int)pararms.page, (int)pararms.rows));
}
[HttpGet]
public ActionResult Edit(Guid? supervisionUserID)
{
ProjectRecordTeacherView projectRecordTeacherView = new ProjectRecordTeacherView();
if (supervisionUserID.HasValue && supervisionUserID != Guid.Empty)
{
projectRecordTeacherView = supervisionUserServices.GetProjectRecordTeacherView(supervisionUserID);
}
return View(projectRecordTeacherView);
}
///
/// 编辑
///
///
///
[HttpPost]
public ActionResult Edit(ProjectRecordTeacherView projectRecordTeacherView)
{
try
{
supervisionUserServices.Save(projectRecordTeacherView);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "保存成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "保存失败,原因:" + ex.Message + "。"
});
}
}
[HttpPost]
public ActionResult Delete(string supervisionUserIDs)
{
try
{
var supervisionUserIDList = supervisionUserIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
supervisionUserServices.Delete(supervisionUserIDList);
return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功" });
}
catch (Exception ex)
{
return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败,原因:" + ex.Message });
}
}
}
}