Exemplo n.º 1
0
        private static WarViewModel GetWarViewModel(Game game, string p1Name, string p2Name)
        {
            var model = new WarViewModel()
            {
                P1Name = p1Name,
                P2Name = p2Name,
                State  = game.GameState
            };

            return(model);
        }
Exemplo n.º 2
0
        public ActionResult View(int warID)
        {
            var war = warRepository.GetById(warID);

            if (war == null)
            {
                return(NoWarRedirect());
            }

            var vm = new WarViewModel(war, warService, warRepository);

            return(View(vm));
        }
Exemplo n.º 3
0
        public ActionResult Win()
        {
            WarViewModel war = null;

            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:56063/");

            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            HttpResponseMessage response = client.GetAsync("api/war/GetLastWar").Result;

            if (response.IsSuccessStatusCode)
            {
                war = response.Content.ReadAsAsync <WarViewModel>().Result;
            }

            return(View(war));
        }