Ejemplo n.º 1
0
        public void CreateParty(byte[] player1Id, string playerName, byte[] player2Id, string player2Name)
        {
            string partyId = Guid.NewGuid().ToString();

            this.partyRepository.SetPartyID(partyId);

            PartyCreationRequest partyCreationRequest = new PartyCreationRequest
            {
                PartyId        = partyId.ToString(),
                Player1Id      = ConvertByteArrayToString(player1Id),
                Player1Name    = playerName,
                Player2Id      = ConvertByteArrayToString(player2Id),
                Player2Name    = player2Name,
                PartyStartTime = DateTime.Now.ToString("yyy-MM-dd HH:mm:ss")
            };

            string json2 = JsonConvert.SerializeObject(partyCreationRequest);

            StringContent content = new StringContent(json2, Encoding.UTF8, "application/json");

            this.httpClient = new HttpClient();
            this.httpClient.DefaultRequestHeaders.Add("contentType", "application/json");
            this.httpClient.DefaultRequestHeaders.Add("Accept", "*/*");
            this.httpClient.DefaultRequestHeaders.Add("Accept-Encoding", "gzip, deflate, br");
            this.httpClient.DefaultRequestHeaders.Add("Connection", "keep-alive");
            HttpResponseMessage response = null;
            string postUrl = URL + "/CreateParty";

            try
            {
                response = this.httpClient.PostAsync(postUrl, content).Result;
            }
            catch (Exception e)
            {
                var ff = e;
            }

            string responseString      = response.Content.ReadAsStringAsync().Result;
            Object accessTokenResponse = JsonConvert.DeserializeObject <Object>(responseString);
            var    test = 0;
        }
Ejemplo n.º 2
0
 public virtual IActionResult CreateTournamentParty([FromBody] PartyCreationRequest request)
 {
     throw new NotImplementedException();
 }