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