public async Task <IActionResult> RegisterNewPatient([FromBody] RegisterNewPatientViewModel patientViewModel) { if (!ModelState.IsValid) { NotifyModelStateErrors(); return(Response(patientViewModel)); } _patientAppService.Register(patientViewModel); return(Response(patientViewModel)); }
public async Task <IActionResult> Register(RegisterNewPatientViewModel patientViewModel) { if (!ModelState.IsValid) { return(View(patientViewModel)); } var client = _clientFactory.CreateClient(); var response = await client.PostAsync("https://csu-patient.azurewebsites.net/patient-register", new StringContent(JsonConvert.SerializeObject(patientViewModel), Encoding.UTF8, "application/json")); if (!response.IsSuccessStatusCode) { return(BadRequest(response.StatusCode)); } return(RedirectToAction(nameof(Index))); }
public void Register(RegisterNewPatientViewModel patientViewModel) { var registerCommand = _mapper.Map <RegisterNewPatientCommand>(patientViewModel); _bus.SendCommand(registerCommand); }