AipConfigController.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using AipDatabase.API.Controllers.Base;
  2. using AipDatabase.API.Domain;
  3. using AipDatabase.API.Interfaces;
  4. using AipDatabase.API.Models;
  5. using AipDatabase.API.Models.Response;
  6. using Microsoft.AspNetCore.Mvc;
  7. using Swashbuckle.AspNetCore.Annotations;
  8. namespace AipDatabase.API.Controllers
  9. {
  10. [ApiController]
  11. [Route("/service/api/db/aipConfig")]
  12. [Produces("application/json")]
  13. public class AipConfigController : BaseModule
  14. {
  15. private readonly ILogger<AipConfigController> _log;
  16. private readonly IAipConfigRepository _service;
  17. public AipConfigController(ILogger<AipConfigController> log, IAipConfigRepository service)
  18. {
  19. _log = log;
  20. _service = service;
  21. }
  22. [HttpGet("fileAll")]
  23. [SwaggerResponse(200, type: typeof(ApiResponseModel<List<AipConfig>>))]
  24. public async Task<IResult> FindAll()
  25. {
  26. return await CreateResponseAsync(async () =>
  27. {
  28. var response = await _service.FindAll();
  29. var result = Results.Ok(new ApiResponseModel<List<AipConfig>>()
  30. {
  31. success = true,
  32. errorCode = 0,
  33. errorMessage = GlobalConstants.API_RESULT_SUCCESS,
  34. result = response,
  35. });
  36. return result;
  37. });
  38. }
  39. }
  40. }