示例#1
0
        public ActionResult Post([FromBody] Applicant applicant)
        {
            applicant = ValidateCountry(applicant).Result;
            var result = _validator.Validate(applicant);

            if (result.IsValid)
            {
                var response = _applicantManager.Add(applicant);
                return(CreatedAtAction(nameof(Get), new { id = response.Id }, response));
            }
            return(BadRequest(result.Errors.FirstOrDefault()?.ErrorMessage));
        }