예제 #1
0
        public LancamentosDTO MapperToDTO(Lancamentos lancamento)
        {
            LancamentosDTO lancamentoDTO = new LancamentosDTO
            {
                Id           = lancamento.Id,
                ContaOrigem  = lancamento.ContaOrigem,
                ContaDestino = lancamento.ContaDestino,
                Valor        = lancamento.Valor,
                Operacao     = lancamento.Operacao
            };

            return(lancamentoDTO);
        }
예제 #2
0
        public Lancamentos MapperToEntity(LancamentosDTO lancamentosDTO)
        {
            Lancamentos produto = new Lancamentos
            {
                Id           = lancamentosDTO.Id,
                ContaOrigem  = lancamentosDTO.ContaOrigem,
                ContaDestino = lancamentosDTO.ContaDestino,
                Operacao     = lancamentosDTO.Operacao,
                Valor        = lancamentosDTO.Valor
            };

            return(produto);
        }
예제 #3
0
        public ActionResult Delete([FromBody] LancamentosDTO LançamentoDTO)
        {
            try
            {
                if (LançamentoDTO == null)
                {
                    return(NotFound());
                }

                _applicationServiceLancamentos.Remove(LançamentoDTO);
                return(Ok("Lançamento removido com sucesso!"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
        public ActionResult Put([FromBody] LancamentosDTO LancamentoDTO)
        {
            try
            {
                if (LancamentoDTO == null)
                {
                    return(NotFound());
                }

                _applicationServiceLancamentos.Update(LancamentoDTO);
                return(Ok("Lançamento atualizado com sucesso!"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #5
0
        public IEnumerable <LancamentosDTO> MapperListLancamentos(IEnumerable <Lancamentos> lancamentos)
        {
            foreach (var item in lancamentos)
            {
                LancamentosDTO produtoDTO = new LancamentosDTO
                {
                    Id           = item.Id,
                    ContaOrigem  = item.ContaOrigem,
                    ContaDestino = item.ContaDestino,
                    Operacao     = item.Operacao,
                    Valor        = item.Valor,
                };

                produtoDTOs.Add(produtoDTO);
            }
            return(produtoDTOs);
        }
예제 #6
0
        public ActionResult Post([FromBody] LancamentosDTO lancamentoDTO)
        {
            try
            {
                if (lancamentoDTO == null)
                {
                    return(NotFound());
                }


                _applicationServiceLancamentos.Add(lancamentoDTO);
                return(Ok("o Lançamento foi cadastrado com sucesso"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #7
0
        public void Update(LancamentosDTO obj)
        {
            var objLancamento = _mapperLancamentos.MapperToEntity(obj);

            _serviceLancamentos.Update(objLancamento);
        }
예제 #8
0
        public void Add(LancamentosDTO obj)
        {
            var objProduto = _mapperLancamentos.MapperToEntity(obj);

            _serviceLancamentos.Add(objProduto);
        }