Ejemplo n.º 1
0
        public async Task <ActionResult> Index(GetWord getWord)
        {
            string Name = getWord.Name;

            using (var client = new HttpClient())
            {
                //Passing service base url
                client.BaseAddress = new Uri("http://localhost:53332/");

                client.DefaultRequestHeaders.Clear();
                //Define request data format
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                //Sending request to find web api REST service resource GetAllEmployees using HttpClient
                HttpResponseMessage Res = await client.GetAsync("api/Values/Get?number=" + getWord.Word);

                //Checking the response is successful or not which is sent using HttpClient
                if (Res.IsSuccessStatusCode)
                {
                    //Storing the response details recieved from web api
                    var apiResponse = Res.Content.ReadAsStringAsync().Result;

                    //Deserializing the response recieved from web api and storing into the Employee list

                    getWord      = JsonConvert.DeserializeObject <GetWord>(apiResponse);
                    getWord.Name = Name;
                }
                if (ModelState.IsValid)
                {
                    return(RedirectToAction("Details", new { name = getWord.Name, word = getWord.Word }));
                }
                //returning the employee list to view
                return(View());
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            //Console.WriteLine("het nummer is {0}", AddNumber(3));
            NumberChanger nc = new NumberChanger(AddNumber);

            Console.WriteLine("het nummer is {0}", nc(5));
            Console.WriteLine("het nummer is {0}", nc.Invoke(3));
            NumberChanger ncMult = new NumberChanger(Multinumber);

            Console.WriteLine("Het nummer is {0}", ncMult(2));
            NumberChanger ncDev = new NumberChanger(DevideNumber);

            Console.WriteLine("Het nummer is {0}", ncDev(2));
            NumberChanger ncSub = new NumberChanger(subtractNumber);

            Console.WriteLine("Het nummer is {0}", ncSub(3));

            TextChanger tc = new TextChanger(AddText);

            Console.WriteLine("De tekst is {0}", tc(" en ik wil een kopje koffie"));

            //instantiate the delegate
            //TextChanger word = DelegateMethod;
            //call the delegate
            //word("helloow");
            GetWord  word  = WordValue;
            GetValue value = NumberValue;

            value(5);
            value(ncSub(5));
            //value(nc(1));
            value(ncMult(5));
            word(message);
        }
Ejemplo n.º 3
0
        public ActionResult Details(string name, string word)
        {
            var model = new GetWord();

            model.Name = name;
            model.Word = word.ToUpper();
            return(View(model));
        }
Ejemplo n.º 4
0
    public void CheckCharacter(string character)
    {
        info.SetActive(false);
        Text    wordText = word.GetComponent <Text> ();
        GetWord gameWord = word.GetComponent <GetWord> ();

        if (!gameWord.CheckChar(character))
        {
            missCounter++;
            hangman.GetComponent <UpdateHangman> ().DrawNextStage();
            if (missCounter == 11)
            {
                Debug.Log("GameOver");
                gameOver.SetActive(true);
                string s = "";
                foreach (char c in gameWord.word)
                {
                    s += c.ToString() + " ";
                }
                wordText.text      = s.Trim();
                wordText.color     = new Color(1, 0, 0);
                wordText.fontStyle = FontStyle.Bold;
                endGame(false);
            }
        }
        else
        {
            if (wordText.text.Replace(" ", string.Empty) == gameWord.word)
            {
                Debug.Log("YouWin");
                youWin.SetActive(true);
                currentStreak++;
                wordText.color     = Color.green;
                wordText.fontStyle = FontStyle.Bold;
                endGame(true);
            }
        }
    }
Ejemplo n.º 5
0
    static void Main()
    {
        Random rnd = new Random();
        int    i;
        string mode;

        Console.WriteLine("Ru: Вас приветствует программа для изучения чисел");
        Console.WriteLine("    на английском языке. Пожалуйста, выберите");
        Console.WriteLine("    подходящий для вас режим обучения");

        Console.WriteLine();

        Console.WriteLine("En: You are welcomed program for learning numbers");
        Console.WriteLine("    in English. Please select");
        Console.WriteLine("    the appropriate mode of training for you");

        Console.WriteLine();

        Console.WriteLine("1. A Hundred => 100");
        Console.WriteLine("2. A Hundred => Сто");
        Console.WriteLine("3. 100       => A Hundred");
        Console.WriteLine("4. Сто       => A Hundred");

        Console.WriteLine("\nВведите номер режима: ");
        mode = Console.ReadLine();
        Console.WriteLine();

        switch (mode)
        {
        case "1":
            for (; ;)
            {
                Console.WriteLine();
                i = rnd.Next(-9999, 10000);
                Console.WriteLine(GetWord.Go(i));
                Console.ReadKey();
                Console.WriteLine();
                Console.WriteLine(i);
                Console.WriteLine();
                Console.ReadKey();
            }

        case "2":
            for (; ;)
            {
                Console.WriteLine();
                i = rnd.Next(-9999, 10000);
                Console.WriteLine(GetWord.Go(i));
                Console.ReadKey();
                Console.WriteLine();
                Console.WriteLine(GetWord.Go(i, true));
                Console.WriteLine();
                Console.ReadKey();
            }

        case "3":
            for (; ;)
            {
                Console.WriteLine();
                i = rnd.Next(-9999, 10000);
                Console.WriteLine(i);
                Console.ReadKey();
                Console.WriteLine();
                Console.WriteLine(GetWord.Go(i));
                Console.WriteLine();
                Console.ReadKey();
            }

        case "4":
            for (; ;)
            {
                Console.WriteLine();
                i = rnd.Next(-9999, 10000);
                Console.WriteLine(GetWord.Go(i, true));
                Console.ReadKey();
                Console.WriteLine();
                Console.WriteLine(GetWord.Go(i));
                Console.WriteLine();
                Console.ReadKey();
            }

        default:
            Console.WriteLine("Ooops! Кажется вы ввели неверное значение!");
            Console.WriteLine("Своими необдуманными действиями вы сдвинули");
            Console.WriteLine("центр нашей планеты. Мы все умрем!");
            Console.ReadKey();
            Console.Write("\n\nТы грязный ублюдок! Это все из за тебя!");
            Console.ReadKey();
            Console.Write("\rВСТРЕТИМСЯ В АДУ !!!!!!!11111          ");
            Console.ReadKey();
            break;
        }
    }