コード例 #1
0
        public async Task <IActionResult> Edit(int id)
        {
            try
            {
                var patient = await _client.SendRequestAsync <Patient>(HttpMethod.Get, $"Patients/{id}");

                if (patient == null)
                {
                    return(NotFound());
                }
                var model = PatientViewModel.GetModel(patient);
                return(View(model));
            }
            catch (HttpRequestException)
            {
                throw new ServerConnectionException();
            }
        }
コード例 #2
0
        public async Task <IActionResult> Details(int id)
        {
            if (TempData["message"] != null)
            {
                ModelState.AddModelError("info", _localizer[TempData["message"].ToString()]);
            }
            try
            {
                var patient = await _client.SendRequestAsync <Patient>(HttpMethod.Get, $"Patients/{id}");

                if (patient == null)
                {
                    return(NotFound());
                }
                var model = PatientViewModel.GetModel(patient);
                return(View(model));
            }
            catch (HttpRequestException)
            {
                throw new ServerConnectionException();
            }
        }