您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

LuController.cs 1018B

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Collections.Generic;
  2. using Luticate2.Utils.Dbo.Basic;
  3. using Luticate2.Utils.Dbo.Result;
  4. using Microsoft.AspNetCore.Mvc;
  5. namespace Luticate2.Utils.Controllers
  6. {
  7. public abstract class LuController : Controller
  8. {
  9. protected IDictionary<object, object> LuItems => HttpContext.GetLuItems();
  10. protected LuApiWrapperDbo<T> Handle<T>(LuResult<T> result)
  11. {
  12. if (result)
  13. {
  14. return new LuApiWrapperDbo<T>
  15. {
  16. code = 200,
  17. data = result.Data,
  18. message = null,
  19. Version = LuUtilsExtensions.Options.Version
  20. };
  21. }
  22. throw new LuResultException(result.To<object>());
  23. }
  24. protected LuApiWrapperDbo<LuBoxedValueDbo<T>> HandleBoxed<T>(LuResult<T> result)
  25. {
  26. return Handle(result.To(arg => new LuBoxedValueDbo<T>
  27. {
  28. Value = arg
  29. }));
  30. }
  31. }
  32. }