53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using RestSharp;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Tanshu.Accounts.Entities;
|
|
|
|
|
|
namespace Tanshu.Accounts.Repository
|
|
{
|
|
public static class TaxBI
|
|
{
|
|
public static IList<Tax> List()
|
|
{
|
|
var request = new RestRequest();
|
|
request.Resource = "Taxes.json";
|
|
return JsonStore.Execute<List<Tax>>(request);
|
|
}
|
|
|
|
public static Tax Get(Guid id)
|
|
{
|
|
var request = new RestRequest();
|
|
request.Resource = "Tax/{id}.json";
|
|
request.AddParameter("id", id, ParameterType.UrlSegment);
|
|
return JsonStore.Execute<Tax>(request);
|
|
}
|
|
|
|
public static Tax Delete(Guid id)
|
|
{
|
|
var request = new RestRequest(Method.DELETE);
|
|
request.Resource = "Tax/{id}.json";
|
|
request.AddParameter("id", id, ParameterType.UrlSegment);
|
|
return JsonStore.Execute<Tax>(request);
|
|
}
|
|
|
|
public static Tax Insert(Tax tax)
|
|
{
|
|
var request = new RestRequest(Method.PUT);
|
|
request.Resource = "Tax.json";
|
|
request.AddJsonBody(tax);
|
|
return JsonStore.Execute<Tax>(request);
|
|
}
|
|
|
|
public static Tax Update(Tax tax)
|
|
{
|
|
var request = new RestRequest(Method.POST);
|
|
request.Resource = "Tax/{id}.json";
|
|
request.AddParameter("id", tax.TaxID, ParameterType.UrlSegment);
|
|
request.AddJsonBody(tax);
|
|
return JsonStore.Execute<Tax>(request);
|
|
}
|
|
|
|
}
|
|
}
|