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 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. [HttpGet("options")]
  38. public async Task<IActionResult> GetOptions()
  39. {
  40. return Ok(await _applicantService.GetOptions());
  41. }
  42. [HttpPost("selection-init")]
  43. public async Task<IActionResult> InitSelection(ApplicantProcessRequestDTO model)
  44. {
  45. await _applicantService.InitializeProcess(model);
  46. return Ok();
  47. }
  48. [HttpPost("apply-for-ad")]
  49. public async Task<IActionResult> ApplyForAd([FromBody]ApplyForAdRequestDto request)
  50. {
  51. await _applicantService.ApplyForAAd(request);
  52. return Ok();
  53. }
  54. }
  55. }