public IActionResult CreateOrEdit(ContaBancariaViewModel model) { ContaBancariaDto dto = new ContaBancariaDto(); SetPropriy(model, dto); _contabancariastore.Store(dto); return(RedirectToAction("Index")); }
private static void SetPropriy(ContaBancariaViewModel model, ContaBancariaDto dto) { dto.ID = model.ID; dto.EMPRESAID = model.EMPRESAID; dto.DESCRICAO = model.DESCRICAO; dto.CODBANCO = model.CODIGOBANCO; dto.CONTA = model.CONTA; dto.AGENCIA = model.AGENCIA; dto.GERENTE = model.GERENTE; dto.TELEFONE = model.TELEFONE; dto.DATAABERTURA = model.DATAABERTURA; }
public void Store(ContaBancariaDto dto) { var empresa = _empresarepository.GetById(dto.EMPRESAID); DomainException.When(empresa == null, "Empresa Invalida"); var contabancaria = _contabancariarepository.GetById(dto.ID); if (contabancaria is null) { contabancaria = new ContaBancaria(empresa, dto.DESCRICAO, dto.CODBANCO, dto.AGENCIA, dto.CONTA, dto.GERENTE, dto.TELEFONE, dto.DATAABERTURA); _contabancariarepository.Save(contabancaria); } else { contabancaria.Update(empresa, dto.DESCRICAO, dto.CODBANCO, dto.AGENCIA, dto.CONTA, dto.GERENTE, dto.TELEFONE, dto.DATAABERTURA); _contabancariarepository.Save(contabancaria); } }