public async Task <IActionResult> CreateApplicant([FromBody] CreateApplicantDTO applicantDTO) { if (!ModelState.IsValid) { _logger.LogError($"Invalid POST attempt in {nameof(CreateApplicant)}"); return(BadRequest(ModelState)); } var applicant = _mapper.Map <Applicant>(applicantDTO); await _unitOfWork.Applicants.Insert(applicant); await _unitOfWork.Save(); return(CreatedAtRoute("CreateApplicant", new { id = applicant.Id }, applicant)); }
public void CreateApplicant(CreateApplicantDTO input) { var m = _recruiterRepository.GetAll() .WhereIf(AbpSession.UserId != null, t => t.CreatorUserId == AbpSession.UserId) .Count <RecruiterDetails>(); if (m >= 1) { throw new Abp.UI.UserFriendlyException("Already Exists"); } else { var applicant = ObjectMapper.Map <ApplicantDetails>(input); _applicantRepository.Insert(applicant); } }