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.

ApplicantsController.cs 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Diligent.WebAPI.Contracts.DTOs.Applicant;
  2. namespace Diligent.WebAPI.Host.Controllers.V1
  3. {
  4. [ApiVersion("1.0")]
  5. [Route("v{version:apiVersion}/applicants")]
  6. [ApiController]
  7. public class ApplicantsController : ControllerBase
  8. {
  9. private readonly IApplicantService _applicantService;
  10. public ApplicantsController(IApplicantService applicantService)
  11. {
  12. _applicantService = applicantService;
  13. }
  14. [HttpGet]
  15. public async Task<IActionResult> GetFilteredApplicants([FromQuery] ApplicantFilterDto applicantFilterDto) =>
  16. Ok(await _applicantService.GetFilteredApplicants(applicantFilterDto));
  17. [Authorize]
  18. [HttpGet("{id}")]
  19. public async Task<IActionResult> GetById(int id) =>
  20. Ok(await _applicantService.GetById(id));
  21. [Authorize]
  22. [HttpGet("adsApplicants")]
  23. public async Task<IActionResult> GetAllAdsApplicants([FromQuery]ApplicantFilterDto applicantFilterDto) =>
  24. Ok(await _applicantService.GetAllAdsApplicants(applicantFilterDto));
  25. [Authorize]
  26. [HttpDelete]
  27. public async Task<IActionResult> DeleteApplicant(int id)
  28. {
  29. await _applicantService.DeleteApplicant(id);
  30. return Ok();
  31. }
  32. [HttpGet("processes/{id}")]
  33. public async Task<IActionResult> GetProcesses(int id)
  34. {
  35. return Ok(await _applicantService.GetApplicantWithSelectionProcessesById(id));
  36. }
  37. }
  38. }