KjhTdkController.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using CP.Model;
  2. using NIU.Core;
  3. using NIU.Core.Log;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.Mvc;
  9. namespace CP.Admin.Controllers
  10. {
  11. public class KjhTdkController : AdminBaseController
  12. {
  13. // GET: KjhTdk
  14. public ActionResult Index()
  15. {
  16. return View();
  17. }
  18. public JsonResult GetList(string ename = "")
  19. {
  20. var list = new List<Cz>();
  21. if (string.IsNullOrWhiteSpace(ename))
  22. {
  23. list = CzData.GetCzList();
  24. }
  25. else
  26. {
  27. list = CzData.SearchByEname(ename);
  28. }
  29. return Json(list);
  30. }
  31. public ActionResult Edit(int cid)
  32. {
  33. var model = CzData.GetByCid(cid);
  34. return View(model);
  35. }
  36. [HttpPost]
  37. public JsonResult Edit(Cz model)
  38. {
  39. var apiResult = new APIResult();
  40. try
  41. {
  42. CzData.UpdateTDK(model);
  43. }
  44. catch (Exception ex)
  45. {
  46. apiResult.Ret = -1;
  47. apiResult.Msg = ex.Message;
  48. if (!(ex is OperationExceptionFacade))
  49. LogFactory.GetLogger().Log(LogLevel.Error, ex);
  50. }
  51. return Json(apiResult);
  52. }
  53. }
  54. }