public async Task <ActionResult <PatientViewModel> > Post([FromBody] PatientRequestViewModel patientRequestViewModel) { if (!ModelState.IsValid) { return(BadRequest("Invalid JSON")); } try { _logger.LogInformation($"Add new patient FirstName :{patientRequestViewModel.FirstName} "); var model = _mapper.Map <PatientModel>(patientRequestViewModel); model = await _patientManager.AddNewPatientAsync(model); var result = _mapper.Map <PatientViewModel>(model); return(StatusCode(201, result)); } catch (Exception e) { throw new HttpStatusCodeException(500, "Error happend when create new patient." + e.Message); } }