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