public async Task <IActionResult> Edit(int id, [Bind("Menus,Url,Id,Ativo,DataCadastro,UltimaAtualizacao,Deletado,DeletadoData")] Menu menu) { if (id != menu.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(menu); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MenuExists(menu.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(menu)); }
public async Task <IActionResult> Edit(int id, [Bind("Database,CNPJ,IE,RazaoSocial,Fantasia,DataAbertura,Email,Website,CEP,Logradouro,Numero,Complemento,Bairro,Cidade,Uf,Unidade,IBGE,GIA,Id,Ativo,DataCadastro")] Empresa empresa) { if (id != empresa.Id) { return(NotFound()); } if (ModelState.IsValid) { try { //Remover caracteres do CPForCNPJ empresa.CNPJ = RemoverCaracteres.StringSemFormatacao(empresa.CNPJ); if (empresa.Deletado != true) { empresa.Deletado = false; } _context.Update(empresa); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmpresaExists(empresa.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(empresa)); }
public async Task <IActionResult> Edit(int id, [Bind("SubMenus,Controller,Titulo,MenuId,Id,Ativo,DataCadastro,UltimaAtualizacao,Deletado,DeletadoData")] SubMenu subMenu) { if (id != subMenu.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(subMenu); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubMenuExists(subMenu.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["MenuId"] = new SelectList(_context.Menu, "Id", "Id", subMenu.MenuId); return(View(subMenu)); }