// GET: Empresas public async Task <IActionResult> Index() { var salesWebMvcContext = _context.Empresa.OrderBy(e => e.RazaoSocial).Where(e => e.Deletado == false); foreach (var item in salesWebMvcContext) { item.CNPJ = FormatarString.FormateCPForCNPJ(item.CNPJ); } return(View(await salesWebMvcContext.ToListAsync())); }
// GET: Empresas/Edit/5 public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } var empresa = await _context.Empresa.FindAsync(id); if (empresa == null) { return(NotFound()); } empresa.CNPJ = FormatarString.FormateCPForCNPJ(empresa.CNPJ); empresa.UltimaAtualizacao = DateTime.Now; return(View(empresa)); }