Example #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);
        }
 public ServicoViewModel GetServicoById(int servicoId)
 {
     return(_mapper.Map <ServicoViewModel>(_servicoRepository.GetServicoById(servicoId)));
 }