示例#1
0
        private async Task DownvoteAsync()
        {
            var client          = ClientFactory.CreateClient("ServerAPI");
            var responseMessage = await client.SendAsync(
                new HttpRequestMessage
            {
                Method     = new HttpMethod("POST"),
                RequestUri = new Uri($"https://localhost:44360/api/liking/{Id}/dislike")
            }
                );

            LikeResult = await responseMessage.Content.ReadFromJsonAsync <LikingDto>();
        }
示例#2
0
        protected override async Task OnInitializedAsync()
        {
            var client = ClientFactory.CreateClient("ServerAPI");

            LikeResult = await client.GetFromJsonAsync <LikingDto>($"/api/liking/{Id}");
        }