纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

3 years ago
  1. using NFine.Code;
  2. using System.Web.Mvc;
  3. namespace NFine.Web
  4. {
  5. [HandlerLogin]
  6. public abstract class ControllerBase : Controller
  7. {
  8. public Log FileLog
  9. {
  10. get { return LogFactory.GetLogger(this.GetType().ToString()); }
  11. }
  12. [HttpGet]
  13. [HandlerAuthorize]
  14. public virtual ActionResult Index()
  15. {
  16. return View();
  17. }
  18. [HttpGet]
  19. [HandlerAuthorize]
  20. public virtual ActionResult Form()
  21. {
  22. return View();
  23. }
  24. [HttpGet]
  25. [HandlerAuthorize]
  26. public virtual ActionResult Details()
  27. {
  28. return View();
  29. }
  30. protected virtual ActionResult Success(string message)
  31. {
  32. return Content(new AjaxResult { state = ResultType.success.ToString(), message = message }.ToJson());
  33. }
  34. protected virtual ActionResult Success(string message, object data)
  35. {
  36. return Content(new AjaxResult { state = ResultType.success.ToString(), message = message, data = data }.ToJson());
  37. }
  38. protected virtual ActionResult Error(string message)
  39. {
  40. return Content(new AjaxResult { state = ResultType.error.ToString(), message = message }.ToJson());
  41. }
  42. }
  43. }