Esempio n. 1
0
        public async Task <JsonResult> GetPagamentoDetalhes(int id)
        {
            var servico = await _agendamento.GetByIdAsync(id);

            var agendamentos = await _agendamento.GetAllAsync(x => x.ClienteId == servico.ClienteId);

            //Se tiver pataz, calcula quantos ele tem
            var pz = 0;

            if (agendamentos.Any())
            {
                var pataz = await _clientePontuacao.GetByIdAsync(x => x.ClienteId == servico.ClienteId);

                pz = pataz == null ? 0 : pataz.Pontos ?? 0;
            }

            var result = new
            {
                cliente      = servico.Cliente.Nome,
                pet          = servico.Animal.Nome,
                servico      = servico.Servico.Nome,
                valor        = servico.Servico.Preco.ToString("N"),
                pataz        = pz,
                pzNecessario = servico.Servico.PatazNecessario ?? 0,
                pzFinal      = servico.Servico.PatazRecebido ?? 0
            };

            return(Json(result));
        }
Esempio n. 2
0
        // Função que salva em uma bag temporária a pontuação do cliente
        private async Task ConsultaPetz()
        {
            var pontos = await _clientePontuacao.GetByIdAsync(x => x.ClienteId == User.Identity.GetId());

            ViewBag.Pontos = pontos.Pontos ?? 0;
        }