52 lines
1.8 KiB
C#
52 lines
1.8 KiB
C#
using RestSharp;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Tanshu.Accounts.Entities;
|
|
|
|
namespace Tanshu.Accounts.Repository
|
|
{
|
|
public static class MachineLocationBI
|
|
{
|
|
public static IList<MachineLocation> List()
|
|
{
|
|
var request = new RestRequest();
|
|
request.Resource = "MachineLocations.json";
|
|
return JsonStore.Execute<List<MachineLocation>>(request);
|
|
}
|
|
|
|
public static MachineLocation Get(string machineName)
|
|
{
|
|
var request = new RestRequest();
|
|
request.Resource = "MachineLocation.json";
|
|
request.AddQueryParameter("n", machineName);
|
|
return JsonStore.Execute<MachineLocation>(request);
|
|
}
|
|
|
|
public static MachineLocation Get(Guid id)
|
|
{
|
|
var request = new RestRequest();
|
|
request.Resource = "MachineLocation/{id}.json";
|
|
request.AddParameter("id", id, ParameterType.UrlSegment);
|
|
return JsonStore.Execute<MachineLocation>(request);
|
|
}
|
|
|
|
public static MachineLocation Insert(MachineLocation machineLocation)
|
|
{
|
|
var request = new RestRequest(Method.PUT);
|
|
request.Resource = "MachineLocation.json";
|
|
request.AddJsonBody(machineLocation);
|
|
return JsonStore.Execute<MachineLocation>(request);
|
|
}
|
|
|
|
public static MachineLocation Update(MachineLocation machineLocation)
|
|
{
|
|
var request = new RestRequest(Method.POST);
|
|
request.Resource = "MachineLocation/{id}.json";
|
|
request.AddParameter("id", machineLocation.MachineLocationID, ParameterType.UrlSegment);
|
|
request.AddJsonBody(machineLocation);
|
|
return JsonStore.Execute<MachineLocation>(request);
|
|
}
|
|
|
|
}
|
|
}
|