示例#1
0
        public ActionResult Post([FromBody] ApplicantModel applicantModel)
        {
            Applicant applicant = new Applicant();

            _LogHelper.Information(String.Format("Post regqest 'api/applicant has come.'"));

            try
            {
                if (ModelState.IsValid)
                {
                    applicant = _Mapper.Map <Applicant>(applicantModel);
                    _ApplicantManager.Create(applicant);
                }
            }
            catch (Exception ex)
            {
                _LogHelper.Error(String.Format("Post regqest 'api/applicant got the followwing error: {0}", ex.ToString()));
                throw new ApiException(ex.Message, System.Net.HttpStatusCode.BadRequest);
            }

            return(Created(string.Format("/api/Applicant/{0}", applicant.ID), applicant));
        }