public ActionResult DealerStand() { if (Request.IsAjaxRequest()) { var service = new BlackjackServiceClient(); var result = service.DealerStand(); return Json(result, JsonRequestBehavior.AllowGet); } return RedirectToAction("Index"); }
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"); }