public async Task <int> InsertFood(FoodEnteredTable food)
        {
            var num = database.Insert(food);

            database.Commit();
            return(num);
        }
        public async Task <bool> CheckIfExists(FoodEnteredTable food)
        {
            await SyncAsync(true);

            var check = await azureSyncTable.Where(x => x.FoodID == food.FoodID).ToListAsync();

            return(check.Any());
        }
        public async Task <int> InsertFood(FoodEnteredTable food)
        {
            await SyncAsync(true); //opens

            await azureSyncTable.InsertAsync(food);

            await SyncAsync(); //closes

            return(1);
        }
Beispiel #4
0
        protected override void Seed(FoodEnteredTableContext context)
        {
            var foodEntered = new FoodEnteredTable
            {
                UserID = "1",
                FoodID = "1",
                Date   = DateTime.Now
            };

            context.Set <FoodEnteredTable>().Add(foodEntered);
            base.Seed(context);
        }
        public async Task <bool> CheckIfExists(FoodEnteredTable food)
        {
            var exist = database.Table <FoodEnteredTable>().Any(x => x.Id == food.Id);

            return(exist);
        }