public async Task <IActionResult> Details(int id) { var agencia = await agenciaRepository.GetAgencia(id); if (agencia == null) { return(NotFound()); } return(View(agencia)); }
public async Task <IActionResult> Create([FromForm] int SelectedBancoId, [FromForm] int SelectedAgenciaId, [FromForm] int SelectedFilialId, [FromForm] string Descricao, [FromForm] long NumeroDaConta, [FromForm] string DigitoVerificadorCC) { var banco = await bancoRepository.GetBanco(SelectedBancoId); var agencia = await agenciaRepository.GetAgencia(SelectedAgenciaId); var filial = await filialRepository.GetFilial(SelectedFilialId); var newContaCorrente = new ContaCorrente(banco, agencia, filial, DateTime.Now, Descricao, NumeroDaConta, DigitoVerificadorCC, 0); contexto.Set <ContaCorrente>().Add(newContaCorrente); await contexto.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }