Exemplo n.º 1
0
        public async Task <IActionResult> RegisterNewPatient([FromBody] RegisterNewPatientViewModel patientViewModel)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(Response(patientViewModel));
            }

            _patientAppService.Register(patientViewModel);

            return(Response(patientViewModel));
        }
Exemplo n.º 2
0
        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)));
        }
Exemplo n.º 3
0
        public void Register(RegisterNewPatientViewModel patientViewModel)
        {
            var registerCommand = _mapper.Map <RegisterNewPatientCommand>(patientViewModel);

            _bus.SendCommand(registerCommand);
        }