Esempio n. 1
0
        public async Task <MinesboomSelectionResponse> Submit(int optionSelected)
        {
            try
            {
                var mbArgs = new MinesboomSelectionRequest(App.GameId, App.UserId, optionSelected);

                var result = await _apiClient.SubmitMinesBoom(mbArgs);

                return(result);
            }
            catch (System.Exception)
            {
                return(new MinesboomSelectionResponse(0, false, ""));
            }
        }
Esempio n. 2
0
        public async Task <MinesboomSelectionResponse> SubmitMinesBoom(MinesboomSelectionRequest mbArgs)
        {
            var uri = new Uri(_baseAddress + "/games/submit/MinesBoomSession");

            var message = new HttpRequestMessage(HttpMethod.Post, uri)
            {
                Content = new StringContent(JsonConvert.SerializeObject(mbArgs), Encoding.UTF8, "application/json")
            };

            AddHeader(message, mbArgs.UserId.ToString());

            // new ObjectContent(typeof(MinesBoomArgs), (MinesBoomArgs)gameArgs, new JsonMediaTypeFormatter());

            var gameResult = await GetResponse <MinesboomSelectionResponse>(message);

            return(gameResult);
        }