Beispiel #1
0
        public async Task <IActionResult> Edit(int id)
        {
            StudentViewModel fetchedStudent = null;

            using (var httpClient = ClientFactory.CreateClient("GeorestApi"))
            {
                try
                {
                    var georestClient = new GeorestClient(httpClient.BaseAddress.ToString(), httpClient);
                    fetchedStudent = await georestClient.GetStudentByIdAsync(id);
                }
                catch (SwaggerException se)
                {
                    ModelState.AddModelError("", se.Message);
                }
            }
            return(View(fetchedStudent));
        }