Esempio n. 1
0
        public async Task <ActionResult> EnterNumber(EnterNumberViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (!await mediator.SendAsync(new CheckNotificationNumberUnique(model.Number.GetValueOrDefault(), model.CompetentAuthority)))
            {
                ModelState.AddModelError("Number", "A record for this notification number already exists");
                return(View(model));
            }

            var response = await mediator.SendAsync(
                new CreateLegacyNotificationApplication
            {
                CompetentAuthority = model.CompetentAuthority,
                NotificationType   = model.NotificationType,
                Number             = model.Number.GetValueOrDefault()
            });

            return(RedirectToAction("Created", "NewNotification",
                                    new
            {
                area = string.Empty,
                id = response
            }));
        }
Esempio n. 2
0
 public IActionResult EnterNumber(EnterNumberViewModel model)
 {
     if (MyGame.CheckForWinner())
     {
         return(View("EndGame", MyGame.WhoWon()));
     }
     MyGame.Tick(model);
     return(RedirectToAction("GameTurn"));
 }
Esempio n. 3
0
        public void Tick(EnterNumberViewModel turn)
        {
            PlayerOne.Guess = turn.Number;
            PlayerOne.Supposition.Add(PlayerOne.Guess);

            PlayerTwo.Guess = PlayerTwo.GuessNumberV2();
            PlayerTwo.Supposition.Add(PlayerTwo.Guess);
            //PlayerTwo.AddGenNumberToList();
            //WhoWon();
        }
        public async Task<ActionResult> EnterNumber(EnterNumberViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            if (!await mediator.SendAsync(new CheckNotificationNumberUnique(model.Number.GetValueOrDefault(), model.CompetentAuthority)))
            {
                ModelState.AddModelError("Number", "A record for this notification number already exists");
                return View(model);
            }

            var response = await mediator.SendAsync(
                    new CreateLegacyNotificationApplication
                    {
                        CompetentAuthority = model.CompetentAuthority,
                        NotificationType = model.NotificationType,
                        Number = model.Number.GetValueOrDefault()
                    });

            return RedirectToAction("Created", "NewNotification",
                new
                {
                    area = string.Empty,
                    id = response
                });
        }
Esempio n. 5
0
 public IActionResult IndexEnterNumber(EnterNumberViewModel model)
 {
     // HTTP 1.1 GET http://localhost:8080/Game/Didi?myNumber=5&myNumber2=0
     MyGame = new GamePlay(model.Number);
     return(RedirectToAction("GameTurn"));
 }