コード例 #1
0
        public async Task <ActionResult> GetInventory(int id)
        {
            var models = new Inventorypass();

            using (var httpClient = new HttpClient())
            {
                HttpRequestMessage request = CreateRequestToService(HttpMethod.Get,
                                                                    Configuration["ServiceEndpoints:AccountCharacter"] + "/Inventory/" + id.ToString());

                var Response = await httpClient.SendAsync(request);

                if (Response.IsSuccessStatusCode)
                {
                    var jsonString = await Response.Content.ReadAsStringAsync();

                    List <Item> items     = JsonConvert.DeserializeObject <List <Item> >(jsonString);
                    var         viewmodel = new Inventorypass()
                    {
                        items = items, charID = id
                    };
                    return(View(viewmodel));
                }
            }

            return(View(models));
        }
コード例 #2
0
        public void InvPassPass()
        {
            var invpass = new Inventorypass()
            {
                charID = 1
            };

            Assert.Equal(1, invpass.charID);
        }