Beispiel #1
0
        public async void getAlimentos()
        {
            SrvFingerNation a     = new SrvFingerNation();
            var             lista = await a.GetAllAlimentos();

            if (lista != null)
            {
                foreach (Alimentos alimento in lista)
                {
                    tempAlimentos tla = new tempAlimentos();
                    tla.nombre    = alimento.nombre;
                    tla.categoria = alimento.categoria;
                    listaAli.Add(tla);
                }
            }
        }//getAllAli
Beispiel #2
0
        private async void Edit(object sender, EventArgs e)
        {
            if (listView.SelectedItem != null)
            {
                tempAlimentos   a     = listView.SelectedItem as tempAlimentos;
                SrvFingerNation sr    = new SrvFingerNation();
                var             lista = await sr.GetAllAlimentos();

                foreach (Alimentos alimento in lista)
                {
                    if (alimento.nombre == a.nombre)
                    {
                        App.Current.MainPage = new create_alimento(alimento);
                    }
                }
            }
        }//EDIT
Beispiel #3
0
        }//GO INSERT

        private async void Delete(object sender, EventArgs e)
        {
            if (listView.SelectedItem != null)
            {
                tempAlimentos   a     = listView.SelectedItem as tempAlimentos;
                SrvFingerNation sr    = new SrvFingerNation();
                var             lista = await sr.GetAllAlimentos();

                foreach (Alimentos alimento in lista)
                {
                    if (alimento.nombre == a.nombre)
                    {
                        await sr.DeleteAlimentos(alimento);

                        MainPage mp   = new MainPage();
                        Type     page = typeof(index_alimentos);
                        mp.Detail            = new NavigationPage((Page)Activator.CreateInstance(page));
                        mp.IsPresented       = false;
                        App.Current.MainPage = mp;
                    }
                }
            }
        }