using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using EMIS.CommonLogic.Students; using EMIS.ViewModel.Students; using System.Web.Mvc; using EMIS.ViewModel; namespace EMIS.Web.ApiControllers.StudentManage { public class StudentServicesController : Controller { public IStudentsServices StudentsServices { get; set; } public IStudentRecordServices studentRecordServices { get; set; } public ActionResult GetStudentViewByLoginID(string loginID) { return Json(StudentsServices.GetStudentViewByLoginID(loginID), JsonRequestBehavior.AllowGet); } public ActionResult GetStudentViewByUserID(Guid userID) { return Json(StudentsServices.GetStudentfileView(userID), JsonRequestBehavior.AllowGet); } public ActionResult GetStudentViewByIDNum(string idNum) { return Json(StudentsServices.GetStudentViewByIDNum(idNum), JsonRequestBehavior.AllowGet); } public ActionResult GetStudentChangeFeilds(Guid? UserID) { //return Json(studentRecordServices.GetStudentChangeFeilds(UserID.Value), JsonRequestBehavior.AllowGet); return null; } public ActionResult GetStudentChangeSave(StudentInfoView Model, Guid? UserID) { var Data = new Dictionary(); foreach (var key in typeof(StudentInfoView).GetProperties()) { if (key.PropertyType.IsValueType || key.PropertyType.Name.StartsWith("String")) { Data.Add(key.Name, key.GetValue(Model, null)); } } try { //studentRecordServices.ChangeStudentInfo(Data, UserID.Value); return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功" }); } catch (Exception ex) { return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败,原因:" + ex.Message }); } } } }