Exemple #1
0
 private void FiltraLista()
 {
     if (ListaDesejos.Count > 0)
     {
         ListaFiltrada = new ObservableCollection <Desejo>(ListaDesejos.Where(p => p.Nome.ToLower().Contains(this.Filtro.ToLower()) || p.CategoriaNome.ToLower().Contains(this.Filtro.ToLower())));
     }
 }
Exemple #2
0
 public IEnumerable <ProdutoAgrupadoViewModel> ProdutosAgrupadosPorQuantidade()
 {
     return(ListaDesejos.GroupByCount(3)
            .Select((x, i) => new ProdutoAgrupadoViewModel {
         Indice = i, Quantidade = x.Key, Produtos = x.ToList()
     })
            .OrderBy(x => x.GetCatalogoSeuDesejo()));
 }
Exemple #3
0
        public async Task GetListaDesejos()
        {
            try
            {
                var client = new System.Net.Http.HttpClient();
                client.BaseAddress = new Uri("http://priceless2m.herokuapp.com/");
                var response = await client.GetAsync("api/busca_categorias/W88oZcUg4dTN1dyc07DWD9kRIOUwcPHGSlHuGR47");

                string dadosJson = response.Content.ReadAsStringAsync().Result;

                try
                {
                    ListaCategoria = new ObservableCollection <Categoria>((List <Categoria>)JsonConvert.DeserializeObject(dadosJson, typeof(List <Categoria>)));
                }
                catch (Exception e)
                {
                }

                if (ListaCategoria.Count > 0)
                {
                    this.ListaDesejos = new ObservableCollection <Desejo>();
                    foreach (Categoria categoria in ListaCategoria)
                    {
                        foreach (SubCategoria subCategoria in categoria.sub_categorias)
                        {
                            Desejo desejo = new Desejo(subCategoria.Nome, categoria.nome, categoria.id, subCategoria.Id, 1);
                            ListaDesejos.Add(desejo);
                        }
                    }
                }

                try
                {
                    this.ListaFiltrada = ListaDesejos;
                }
                catch (Exception e)
                {
                }
            }
            catch (Exception e)
            {
                //Debug.WriteLine(e.Message);
            }
        }
Exemple #4
0
 public bool IsFirstMobile(ProdutoViewModel item)
 {
     return(ListaDesejos.IndexOf(item) < 2);
 }
Exemple #5
0
 public bool IsFirst(ProdutoViewModel item)
 {
     return(ListaDesejos.IndexOf(item) == 0);
 }