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

                if (physician == null)
                {
                    return(NotFound());
                }
                var model = PhysicianViewModel.GetModel(physician);

                TempData["message"] = "Your changes has been saved.";
                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 physician = await _client.SendRequestAsync <Physician>(HttpMethod.Get, $"Physicians/{id}");

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