public async Task <IActionResult> Post([FromBody] ApplicantViewModel inputApplicant) { // mapping shoud be done using Automapper or similar libraries but for simplicity it is mapped manually var applicant = new Applicant { Name = inputApplicant.Name, FamilyName = inputApplicant.FamilyName, Address = inputApplicant.Address, Age = inputApplicant.Age, CountryOfOrigin = inputApplicant.CountryOfOrigin, EmailAdress = inputApplicant.EmailAdress, Hired = inputApplicant.Hired }; var applicantValidator = new ApplicantValidator(); var result = await applicantValidator.ValidateAsync(applicant); if (result.IsValid) { var addedApplicant = applicantManager.Add(applicant); if (addedApplicant != null) { logger.Information($"Added new Apllicant with Id:{applicant.ID}"); return(CreatedAtAction("Get", new { id = applicant.ID }, applicant)); } else { logger.Warning("Failed to Add a new Applicant with Post request"); return(BadRequest()); } } else { logger.Warning("Failed to Add a new Applicant with Post request, validation failed"); return(BadRequest()); } }