예제 #1
0
        public ActionResult DealerStand()
        {
            if (Request.IsAjaxRequest())
            {
                var service = new BlackjackServiceClient();
                var result = service.DealerStand();

                return Json(result, JsonRequestBehavior.AllowGet);
            }

            return RedirectToAction("Index");
        }
예제 #2
0
        public ActionResult GiveAllCardsToDealer()
        {
            if (Request.IsAjaxRequest())
            {
                var service = new BlackjackServiceClient();
                IList<Card> cards = new List<Card>(0);

                while (!service.DealerStand())
                {
                    cards.Add(service.GiveCardToDealer());
                }

                return Json((from c in cards
                             select new { Face = c.Face.ToString(), Suit = c.Suit.ToString() }).ToArray(),
                    JsonRequestBehavior.AllowGet);
            }

            return RedirectToAction("Index");
        }