public async Task <IActionResult> Edit(InstructorResponseViewModel viewModel) { IActionResult result = View(); if (ModelState.IsValid) { using (var httpClient = ClientFactory.CreateClient("GeorestApi")) { try { var georestClient = new GeorestClient(httpClient.BaseAddress.ToString(), httpClient); await georestClient.UpdateInstructorResponseAsync((int)viewModel.Id, Mapper.Map <InstructorResponseInputViewModel>(viewModel)); result = RedirectToAction(nameof(Index)); } catch (SwaggerException se) { ModelState.AddModelError("", se.Message); } } } return(result); }