51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Tanshu.Accounts.Entities;
|
|
using RestSharp;
|
|
|
|
namespace Tanshu.Accounts.Repository
|
|
{
|
|
public static class ModifierBI
|
|
{
|
|
public static IList<Modifier> List()
|
|
{
|
|
var request = new RestRequest();
|
|
request.Resource = "Modifiers.json";
|
|
return JsonStore.Execute<List<Modifier>>(request);
|
|
}
|
|
|
|
public static IList<Modifier> List(Guid productGroupID)
|
|
{
|
|
var request = new RestRequest();
|
|
request.Resource = "Modifiers.json";
|
|
request.AddQueryParameter("pg", productGroupID.ToString());
|
|
return JsonStore.Execute<List<Modifier>>(request);
|
|
}
|
|
|
|
public static Modifier Get(Guid id)
|
|
{
|
|
var request = new RestRequest();
|
|
request.Resource = "Modifier/{id}.json";
|
|
request.AddParameter("id", id, ParameterType.UrlSegment);
|
|
return JsonStore.Execute<Modifier>(request);
|
|
}
|
|
|
|
public static Modifier Insert(Modifier modifier)
|
|
{
|
|
var request = new RestRequest(Method.PUT);
|
|
request.Resource = "Modifier.json";
|
|
request.AddJsonBody(modifier);
|
|
return JsonStore.Execute<Modifier>(request);
|
|
}
|
|
|
|
public static Modifier Update(Modifier modifier)
|
|
{
|
|
var request = new RestRequest(Method.POST);
|
|
request.Resource = "Modifier/{id}.json";
|
|
request.AddParameter("id", modifier.ModifierID, ParameterType.UrlSegment);
|
|
request.AddJsonBody(modifier);
|
|
return JsonStore.Execute<Modifier>(request);
|
|
}
|
|
}
|
|
}
|