TestController.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using Business.Test;
  2. using Microsoft.AspNetCore.Mvc;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Reflection;
  6. using System.Threading.Tasks;
  7. namespace Business.Controllers
  8. {
  9. [Area("business")]
  10. [Route("api/business/test")]
  11. public class TestController: BusinessController
  12. {
  13. private readonly ITestAppService _testAppService;
  14. public TestController(ITestAppService testAppService)
  15. {
  16. _testAppService = testAppService;
  17. }
  18. [HttpGet]
  19. public async Task<string> GetAsync(string str)
  20. {
  21. return await _testAppService.TestApi(str);
  22. }
  23. [HttpGet]
  24. [Route("classes")]
  25. public List<string> GetClasses()
  26. {
  27. var theList = Assembly.GetExecutingAssembly().GetTypes()
  28. .Where(t => t.Namespace == "Business.Models.Test")
  29. .ToList();
  30. foreach (var the in theList)
  31. {
  32. var type = the.GetProperties();
  33. }
  34. return null;
  35. }
  36. [HttpGet]
  37. [Route("user-count")]
  38. public Task<long> GetUserCount()
  39. {
  40. return _testAppService.GetUserCount();
  41. }
  42. //[HttpGet]
  43. //[Route("menu-tree")]
  44. //public Task<dynamic> GetMenuTree()
  45. //{
  46. // return _testAppService.GetMenuTree();
  47. //}
  48. }
  49. }