Ejemplo n.º 1
0
        public async Task <ListarBadgeRS> ListarBadgeCliente(ListarBadgeRQ request)
        {
            var badge = new ListarBadgeRS();

            badge.Mensagens        = new List <Mensagem>();
            badge.ProtocoloRetorno = Guid.NewGuid();
            badge.Badges           = new List <BadgeDTO>();
            badge.Valido           = false;

            using (var ctx = new DataBaseContext())
            {
                object[] xParams =
                {
                    new SqlParameter("@IdCliente", request.IdCliente),
                    new SqlParameter("@Busca",     request.Busca.IfEmptyOrWhiteSpace(""))
                };

                var db = await ctx.Database.SqlQuery <BadgeDTO>("exec BadgeListar @IdCliente, @Busca", xParams).ToListAsync();

                if (db.Any())
                {
                    badge.Valido = true;
                    badge.Badges = db;
                }
            }
            return(badge);
        }
Ejemplo n.º 2
0
        private async Task PopulaBadges()
        {
            var request = new ListarBadgeRQ();

            request.IdCliente = AppUserManager.Usuario.IdCliente;
            var response = new ListarBadgeRS();

            response.Badges = new List <BadgeDTO>();

            response = await _clienteService.ListarBadgeCliente(request);

            ViewBag.Badges = response.Badges;
        }