StudentServicesController.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Net.Http;
  6. using EMIS.CommonLogic.Students;
  7. using EMIS.ViewModel.Students;
  8. using System.Web.Mvc;
  9. using EMIS.ViewModel;
  10. namespace EMIS.Web.ApiControllers.StudentManage
  11. {
  12. public class StudentServicesController : Controller
  13. {
  14. public IStudentsServices StudentsServices { get; set; }
  15. public IStudentRecordServices studentRecordServices { get; set; }
  16. public ActionResult GetStudentViewByLoginID(string loginID)
  17. {
  18. return Json(StudentsServices.GetStudentViewByLoginID(loginID), JsonRequestBehavior.AllowGet);
  19. }
  20. public ActionResult GetStudentViewByUserID(Guid userID)
  21. {
  22. return Json(StudentsServices.GetStudentfileView(userID), JsonRequestBehavior.AllowGet);
  23. }
  24. public ActionResult GetStudentViewByIDNum(string idNum)
  25. {
  26. return Json(StudentsServices.GetStudentViewByIDNum(idNum), JsonRequestBehavior.AllowGet);
  27. }
  28. public ActionResult GetStudentChangeFeilds(Guid? UserID)
  29. {
  30. //return Json(studentRecordServices.GetStudentChangeFeilds(UserID.Value), JsonRequestBehavior.AllowGet);
  31. return null;
  32. }
  33. public ActionResult GetStudentChangeSave(StudentInfoView Model, Guid? UserID)
  34. {
  35. var Data = new Dictionary<string, object>();
  36. foreach (var key in typeof(StudentInfoView).GetProperties())
  37. {
  38. if (key.PropertyType.IsValueType || key.PropertyType.Name.StartsWith("String"))
  39. {
  40. Data.Add(key.Name, key.GetValue(Model, null));
  41. }
  42. }
  43. try
  44. {
  45. //studentRecordServices.ChangeStudentInfo(Data, UserID.Value);
  46. return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功" });
  47. }
  48. catch (Exception ex)
  49. {
  50. return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败,原因:" + ex.Message });
  51. }
  52. }
  53. }
  54. }