コード例 #1
0
        public IActionResult CreateOrEdit(ContaBancariaViewModel model)
        {
            ContaBancariaDto dto = new ContaBancariaDto();

            SetPropriy(model, dto);

            _contabancariastore.Store(dto);

            return(RedirectToAction("Index"));
        }
コード例 #2
0
 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;
 }
コード例 #3
0
        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);
            }
        }