Esempio n. 1
0
        public void GetDataFromScreen()
        {
            key     = FindViewById <EditText>(Resource.Id.key);
            name    = FindViewById <EditText>(Resource.Id.name);
            phone   = FindViewById <EditText>(Resource.Id.phone);
            website = FindViewById <EditText>(Resource.Id.website);
            descrip = FindViewById <EditText>(Resource.Id.describe);
            post    = FindViewById <Button>(Resource.Id.buttonPost);

            post.Click += async delegate
            {
                Place item = new Place();
                item.keyPlace = key.Text;
                item.name     = name.Text;
                item.phone    = phone.Text;
                item.website  = website.Text;
                item.discrip  = descrip.Text;

                await placeManager.AddItem(item);

                for (int i = 0; i < listStringBitmap.Count; i++)
                {
                    ImagePlace itemImage = new ImagePlace();
                    itemImage.idPlace    = item.id;
                    itemImage.imagePlace = listStringBitmap[i];
                    await imageManager.AddItem(itemImage);
                }
            };
        }
        public async Task <bool> DeleteItem(ImagePlace item)
        {
            try
            {
                await table.DeleteAsync(item);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public async Task <bool> AddItem(ImagePlace item)
        {
            try
            {
                await table.InsertAsync(item);

                return(true);
            }
            catch
            {
                return(false);
            }
        }