narsil/Tanshu.Accounts.Repository/TaxBI.cs

53 lines
1.5 KiB
C#
Raw Normal View History

2018-08-24 10:41:33 +00:00
using RestSharp;
using System;
using System.Collections.Generic;
using Tanshu.Accounts.Entities;
namespace Tanshu.Accounts.Repository
{
2018-08-24 10:41:33 +00:00
public static class TaxBI
{
2018-08-24 10:41:33 +00:00
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);
}
}
}