LearningformRateController.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.ViewModel.PaymentManage;
  7. using EMIS.CommonLogic.PaymentManage;
  8. using EMIS.ViewModel;
  9. using EMIS.Web.Controls;
  10. using Bowin.Web.Controls.Mvc;
  11. namespace EMIS.Web.Controllers.PaymentManage
  12. {
  13. [Authorization]
  14. public class LearningformRateController : Controller
  15. {
  16. public ILearningformRateServices LearningformRateServices { get; set; }
  17. public ActionResult List()
  18. {
  19. return View();
  20. }
  21. public ActionResult Edit(Guid? LearningformRateID)
  22. {
  23. LearningformRateView learningformRateView = new LearningformRateView();
  24. if (LearningformRateID.HasValue)
  25. {
  26. learningformRateView = LearningformRateServices.GetLearningformRateView(LearningformRateID);
  27. }
  28. else
  29. {
  30. learningformRateView.Rate = 1;
  31. }
  32. return View(learningformRateView);
  33. }
  34. [HttpPost]
  35. public ActionResult List(QueryParamsModel pararms)
  36. {
  37. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  38. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  39. return base.Json(LearningformRateServices.GetLearningformRateViewList(configuretView, (int)pararms.page, (int)pararms.rows));
  40. }
  41. [HttpPost]
  42. public ActionResult Edit(LearningformRateView learningformRateView)
  43. {
  44. try
  45. {
  46. LearningformRateServices.Save(learningformRateView);
  47. return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功。" });
  48. }
  49. catch (Exception ex)
  50. {
  51. return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败:" + ex.Message });
  52. }
  53. }
  54. [HttpPost]
  55. public ActionResult Delete(string learningformRateIDs)
  56. {
  57. try
  58. {
  59. List<Guid?> list = learningformRateIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  60. LearningformRateServices.Delete(list);
  61. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功" });
  62. }
  63. catch (Exception ex)
  64. {
  65. return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败:" + ex.Message });
  66. }
  67. }
  68. }
  69. }