您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ApplicantsController.cs 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. private readonly IFileService _fileService;
  11. public ApplicantsController(IApplicantService applicantService,IFileService fileService)
  12. {
  13. _applicantService = applicantService;
  14. _fileService = fileService;
  15. }
  16. [Authorize]
  17. [HttpGet]
  18. public async Task<IActionResult> GetFilteredApplicants([FromQuery] ApplicantFilterDto applicantFilterDto) =>
  19. Ok(await _applicantService.GetFilteredApplicants(applicantFilterDto));
  20. [Authorize]
  21. [HttpGet("{id}")]
  22. public async Task<IActionResult> GetById(int id) =>
  23. Ok(await _applicantService.GetById(id));
  24. [Authorize]
  25. [HttpGet("adsApplicants")]
  26. public async Task<IActionResult> GetAllAdsApplicants([FromQuery]ApplicantFilterDto applicantFilterDto) =>
  27. Ok(await _applicantService.GetAllAdsApplicants(applicantFilterDto));
  28. [Authorize]
  29. [HttpDelete]
  30. public async Task<IActionResult> DeleteApplicant(int id)
  31. {
  32. await _applicantService.DeleteApplicant(id);
  33. return Ok();
  34. }
  35. [Authorize]
  36. [HttpGet("processes/{id}")]
  37. public async Task<IActionResult> GetProcesses(int id) =>
  38. Ok(await _applicantService.GetApplicantWithSelectionProcessesById(id));
  39. [Authorize]
  40. [HttpGet("options")]
  41. public async Task<IActionResult> GetOptions() =>
  42. Ok(await _applicantService.GetOptions());
  43. [Authorize]
  44. [HttpPost("selection-init")]
  45. public async Task<IActionResult> InitSelection(ApplicantProcessRequestDTO model) =>
  46. Ok(await _applicantService.InitializeProcess(model));
  47. [Authorize]
  48. [HttpPost("apply-for-ad")]
  49. public async Task<IActionResult> ApplyForAd([FromForm]ApplyForAdRequestDto request)
  50. {
  51. await _applicantService.ApplyForAd(request);
  52. return Ok();
  53. }
  54. [HttpGet("get-CV")]
  55. public async Task<IActionResult> GetApplicantCV(string fileName) =>
  56. Ok(await _fileService.GetCV(fileName));
  57. }
  58. }