narsil/Tanshu.Accounts.Repository/ModifierBI.cs

51 lines
1.6 KiB
C#
Raw Normal View History

2018-08-24 10:41:33 +00:00
using System;
using System.Collections.Generic;
using Tanshu.Accounts.Entities;
2018-08-24 10:41:33 +00:00
using RestSharp;
namespace Tanshu.Accounts.Repository
{
2018-08-24 10:41:33 +00:00
public static class ModifierBI
{
2018-08-24 10:41:33 +00:00
public static IList<Modifier> List()
{
2018-08-24 10:41:33 +00:00
var request = new RestRequest();
request.Resource = "Modifiers.json";
return JsonStore.Execute<List<Modifier>>(request);
}
2018-08-24 10:41:33 +00:00
public static IList<Modifier> List(Guid productGroupID)
{
2018-08-24 10:41:33 +00:00
var request = new RestRequest();
request.Resource = "Modifiers.json";
request.AddQueryParameter("pg", productGroupID.ToString());
return JsonStore.Execute<List<Modifier>>(request);
}
2018-08-24 10:41:33 +00:00
public static Modifier Get(Guid id)
{
2018-08-24 10:41:33 +00:00
var request = new RestRequest();
request.Resource = "Modifier/{id}.json";
request.AddParameter("id", id, ParameterType.UrlSegment);
return JsonStore.Execute<Modifier>(request);
}
2018-08-24 10:41:33 +00:00
public static Modifier Insert(Modifier modifier)
{
2018-08-24 10:41:33 +00:00
var request = new RestRequest(Method.PUT);
request.Resource = "Modifier.json";
request.AddJsonBody(modifier);
return JsonStore.Execute<Modifier>(request);
}
2018-08-24 10:41:33 +00:00
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);
}
}
}