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)); }
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)); } }