HighbaseInschoolAgeStatusController.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.CommonLogic.Students.HighBaseTable;
  7. using EMIS.ViewModel;
  8. using Bowin.Web.Controls.Mvc;
  9. namespace EMIS.Web.Controllers.StudentManage.HighBaseTable
  10. {
  11. [Authorization]
  12. public class HighbaseInschoolAgeStatusController : Controller
  13. {
  14. public IInschoolAgeStatusServices InschoolAgeStatusServices { get; set; }
  15. public ActionResult List()
  16. {
  17. return View();
  18. }
  19. [HttpPost]
  20. public ActionResult Update()
  21. {
  22. try
  23. {
  24. InschoolAgeStatusServices.Update(DateTime.Now.Year);
  25. return Json(new ReturnMessage()
  26. {
  27. IsSuccess = true,
  28. Message = "更新成功!"
  29. });
  30. }
  31. catch (Exception ex)
  32. {
  33. return Json(new ReturnMessage()
  34. {
  35. IsSuccess = false,
  36. Message = "更新失败,原因:" + ex.Message + "!"
  37. });
  38. }
  39. }
  40. [HttpPost]
  41. public ActionResult SchoolYearDropDown(DropdownListBindType? bindType)
  42. {
  43. List<DropdownListItem> list = InschoolAgeStatusServices.SchoolYearDropDownList()
  44. .Select(x => new DropdownListItem { Text = x, Value = x })
  45. .OrderByDescending(x => x.Value).ToList();
  46. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  47. DropdownList.FormatDropdownItemList(dbt, list);
  48. return base.Json(list);
  49. }
  50. }
  51. }