public IActionResult MapCandidateToCategory(AddCandidateToCategoryVM candidateXCategory)
 {
     if (candidateXCategory == null || !ModelState.IsValid)
     {
         return(BadRequest());
     }
     try
     {
         var result = this._candidateXCategoryService.Insert(candidateXCategory.ToCandidateXCategory());
         return(CreatedAtAction(nameof(MapCandidateToCategory), result));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
     }
 }
示例#2
0
 public static CandidateXCategory ToCandidateXCategory(this AddCandidateToCategoryVM viewModel) =>
 new CandidateXCategory
 {
     CandidateCategoryId = viewModel.CandidateCategoryId, CandidateId = viewModel.CandidateId
 };