protected override bool run()
        {
            Console.WriteLine("Emptying fridge...");
            IUserProfil service = new UserProfilClient();
            JObject     j       = JObject.Parse(service.emptyFridge(args));

            Console.WriteLine("Your fridge is now empty");
            return(false);
        }
        protected override bool run()
        {
            Console.WriteLine("Removing preferences...");
            System.Threading.Thread.Sleep(1000);
            IUserProfil service = new UserProfilClient();
            JObject     j       = JObject.Parse(service.removePreferences(args));

            Console.WriteLine("Successefully removed");
            JArray array = (JArray)j["items"];

            if (array.Count != 0)
            {
                Console.Write("Except the following items that does not exist : ");
                for (int i = 0; i < array.Count; i++)
                {
                    Console.Write(array[i] + (i == (array.Count - 1) ? "" : ","));
                }
                Console.WriteLine("\n");
            }
            return(false);
        }
        protected override bool run()
        {
            IUserProfil service = new UserProfilClient();;

            Console.WriteLine("Submitting allergies...");
            System.Threading.Thread.Sleep(1000);
            service.inquirePreferences(args);
            Console.WriteLine("Successefully added!");
            JObject response = JObject.Parse(service.inquireAllergies(args));
            JArray  jArray   = (JArray)response["items"];

            if (jArray.Count != 0)
            {
                Console.Write("Except for the following items that does not exist and thus cannot be added as allergies : ");
                for (int i = 0; i < jArray.Count; i++)
                {
                    Console.Write(jArray[i] + (i == (jArray.Count - 1) ? "" : ","));
                }
                Console.WriteLine("\n");
            }
            return(false);
        }
        protected override bool run()
        {
            IUserProfil service = new UserProfilClient();;
            JObject     j       = JObject.Parse(service.addToFridge(args));

            Console.WriteLine("Adding ingredients in the fridge...");
            System.Threading.Thread.Sleep(1000);
            service.addToFridge(args);
            Console.WriteLine("Successefully added!");
            JArray jarray = (JArray)j["items"];

            if (jarray.Count != 0)
            {
                Console.Write("Except the following items that does not exist : ");
                for (int i = 0; i < jarray.Count; i++)
                {
                    Console.Write(jarray[i] + (i == (jarray.Count - 1) ? "" : ","));
                }
                Console.Write("\n");
            }
            return(false);
        }
Exemplo n.º 5
0
        protected override bool run()
        {
            Console.WriteLine("Removing from fridge...");
            System.Threading.Thread.Sleep(1000);
            IUserProfil service = new UserProfilClient();
            JObject     j       = JObject.Parse(service.removePreferences(args));

            Console.WriteLine("Successefully removed!");
            JArray jArray = (JArray)j["items"];

            if (jArray.Count != 0)
            {
                Console.WriteLine("Except " + (jArray.Count > 1 ?   "those items that are not " : "this item that is not") + " in your fridge and thus does not need to be removed :");
                for (int i = 0; i < jArray.Count; i++)
                {
                    Console.Write(jArray[i] + " " + (i == (jArray.Count - 1) ? "" : ","));
                }
                Console.WriteLine("\n");
            }


            return(false);
        }