示例#1
0
        public async Task <IActionResult> Edit(Insurer insurer)
        {
            if (ModelState.IsValid)
            {
                UpdateInsurerViewModel viewModel = new UpdateInsurerViewModel()
                {
                    Phone = insurer.Phone,
                    Name  = insurer.Name,
                    Email = insurer.Email,

                    CEP          = insurer.CEP,
                    Street       = insurer.Street,
                    Neighborhood = insurer.Neighborhood,
                    UF           = insurer.UF,
                    City         = insurer.City,
                    Number       = insurer.Number
                };

                if (await _movtechAPIService.AtualizarSeguradora(insurer.Id, viewModel))
                {
                    return(RedirectToAction(nameof(Index)));
                }
                else
                {
                    ModelState.AddModelError("", "Não Foi possível Atualizar a Corretora");
                    return(View(insurer));
                }
            }
            else
            {
                return(View(insurer));
            }
        }