コード例 #1
0
        private ServicoPagamentoParcela GetServicoPagamentoParcelaByServicoIdAndParcela(int servicoId, int parcela)
        {
            var servicoPagamentoParcela = new ServicoPagamentoParcela();

            try
            {
                var servico = _servicoRepository.GetServicoById(servicoId);

                if (servico != null)
                {
                    var servicoPagamento = GetServicoPagamentoById(servico.ServicoId);

                    if (servicoPagamento != null)
                    {
                        servicoPagamentoParcela = _sGMContext.ServicoPagamentoParcela.AsNoTracking().Where(parc => parc.ServicoPagamentoId == servicoPagamento.ServicoPagamentoId && parc.Parcela == parcela).FirstOrDefault();

                        if (servicoPagamentoParcela == null)
                        {
                            servicoPagamentoParcela = new ServicoPagamentoParcela();
                        }

                        servicoPagamento.FormaPagamento = _formaPagamentoRepository.GetFormaPagamentoById(servicoPagamento.FormaPagamentoId);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(servicoPagamentoParcela);
        }
コード例 #2
0
 public ServicoViewModel GetServicoById(int servicoId)
 {
     return(_mapper.Map <ServicoViewModel>(_servicoRepository.GetServicoById(servicoId)));
 }