Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

DocumentController.cs 883B

12345678910111213141516171819202122232425262728
  1. namespace Diligent.WebAPI.Host.Controllers.V1
  2. {
  3. [ApiVersion("1.0")]
  4. [Route("v{version:apiVersion}/documents")]
  5. [ApiController]
  6. public class DocumentController:ControllerBase
  7. {
  8. private readonly IDocumentService _documentService;
  9. public DocumentController(IDocumentService documentService)
  10. {
  11. _documentService = documentService;
  12. }
  13. [HttpGet]
  14. public async Task<IActionResult> GetAllDocuments() => Ok(await _documentService.GetAllDocuments());
  15. [HttpGet("filter")]
  16. public async Task<IActionResult> GetDocumentsByText(string text) => Ok(await _documentService.GetDocumentsByText(text));
  17. [HttpPost]
  18. public async Task<IActionResult> UploadDocument(IFormFile file)
  19. {
  20. await _documentService.UploadDocument(file);
  21. return Ok();
  22. }
  23. }
  24. }