示例#1
0
        private void SyncronizeIngrdients()
        {
            //Get latest Date when the list was synchronized
            DateTime          LastIngredientUpdate = dataHandler.QueryIngredients().OrderByDescending(i => i.DatedModified).Select(j => j.DatedModified).First();
            List <Ingredient> ServerIngredients    = (List <Ingredient>)serviceHandler.CallService <List <Ingredient> >(@"QueryIngredients");
            List <Ingredient> newIngredients       = ServerIngredients.Where(i => i.DatedModified > LastIngredientUpdate).Select(j => j).ToList();

            if (newIngredients.Count > 0)
            {
                foreach (var item in newIngredients)
                {
                    dataHandler.AddIngredient(item);
                }
            }
        }