コード例 #1
0
        public async Task <VoucherClaimResponse> SubmitClaim(VoucherClaimRequest claim)
        {
            var uri = new Uri(_baseAddress + "voucher/claim");

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

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

            return(await GetResponse <VoucherClaimResponse>(message));
        }
コード例 #2
0
        public async Task <VoucherClaimResponse> ClaimVoucher(int voucherId)
        {
            try
            {
                var claimRequest = new VoucherClaimRequest(voucherId, App.UserId);

                var claimResponse = await _apiClient.SubmitClaim(claimRequest);

                return(claimResponse);
            }
            catch (System.Exception)
            {
                return(new VoucherClaimResponse(VoucherCodes.NoVouchers));
            }
        }