Ejemplo n.º 1
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Categorias.Clear();
                var categorias = await CategoriaDataStore.GetItemsAsync(true);

                foreach (var item in categorias)
                {
                    Categorias.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 2
0
        public bool GuardarCategoria(Categoria objCategoria)
        {
            int items;

            Categorias.Add(objCategoria);
            items = this.SaveChanges();
            return(items > 0);
        }
Ejemplo n.º 3
0
        private void ListarCategorias()
        {
            var categorias = _CategoriaRepository.RecuperarCategorias();

            foreach (var cat in categorias)
            {
                Categorias.Add(cat);
            }
        }
Ejemplo n.º 4
0
        public async Task LoadAsync()
        {
            var categorias = await _receitasDaHoraApiService.GetCategoriasAsync();

            Categorias.Clear();
            foreach (var categoria in categorias)
            {
                Categorias.Add(categoria);
            }
        }
Ejemplo n.º 5
0
        private void PopulaLista()
        {
            var _categorias = new PopulaListaCategorias().Popula();


            foreach (var categoria in _categorias)
            {
                Categorias.Add(categoria);
            }
        }
Ejemplo n.º 6
0
        private async void PesquisarCategoria()
        {
            if (String.IsNullOrEmpty(Pesquisa))
            {
                ListarCategorias();
                return;
            }

            var pesquisa = Categorias.Where(x => x.Nome.ToUpper().Contains(Pesquisa.ToUpper())).ToList();

            Categorias.Clear();

            foreach (var item in pesquisa)
            {
                Categorias.Add(item);
            }
        }
Ejemplo n.º 7
0
        private void SearchEnteComercials(string obj)
        {
            if (string.IsNullOrEmpty(obj))
            {
                return;
            }

            var newCategoria = new Categoria
            {
                NombreCategoria = "Resultados de la búsqueda"
            };

            newCategoria.ListOfSubCategorias.AddRange(
                (from q in _enteComercialRepository.GetEnteComercialsByName(obj)
                 select new SubCategoria()
            {
                Id = q.Id,
                Nombre = q.Nombre,
                LogoUrl = q.LogoUrl,
                TipoSubCategoria = TipoSubCategoria.EnteComercial
            }).ToList());

            if (obj.Length >= 2)
            {
                newCategoria.ListOfSubCategorias.AddRange(
                    (from q in _enteComercialRepository.GetEnteComercialsByTags(obj)
                     select new SubCategoria()
                {
                    Id = q.Id,
                    Nombre = q.Nombre,
                    LogoUrl = q.LogoUrl,
                    TipoSubCategoria = TipoSubCategoria.EnteComercial
                }).ToList());
            }

            Categorias.Clear();
            if (newCategoria.ListOfSubCategorias.Count == 0)
            {
                newCategoria.NombreCategoria = "No se consiguieron resultados";
            }
            Categorias.Add(newCategoria);
        }
Ejemplo n.º 8
0
        private async void ListarCategorias()
        {
            Categorias.Clear();

            var categorias = _CategoriaRepository.RecuperarCategorias();

            if (categorias == null)
            {
                return;
            }

            foreach (var cat in categorias)
            {
                Categorias.Add(cat);
            }

            if (Categorias.Count == 0)
            {
                await _MessageService.MostrarDialog("Despensa", "Cadastre as suas categorias!!,");
            }
        }
 public void agregarCategoria(Categoria categoria)
 {
     Categorias.Add(categoria);
     SaveChanges();
 }