using System; using System.Collections.Generic; using Tanshu.Accounts.Entities; using RestSharp; namespace Tanshu.Accounts.Repository { public static class CustomerBI { public static IList List() { var request = new RestRequest(); request.Resource = "Customers.json"; return JsonStore.Execute>(request); } public static Customer Get(Guid id) { var request = new RestRequest(); request.Resource = "Customer/{id}.json"; request.AddParameter("id", id, ParameterType.UrlSegment); return JsonStore.Execute(request); } public static bool Delete(Guid id) { var request = new RestRequest(Method.DELETE); request.Resource = "Customer/{id}.json"; request.AddParameter("id", id, ParameterType.UrlSegment); return JsonStore.Execute(request); } public static Customer Insert(Customer customer) { var request = new RestRequest(Method.PUT); request.Resource = "Customer.json"; request.AddJsonBody(customer); return JsonStore.Execute(request); } public static Customer Update(Customer customer) { var request = new RestRequest(Method.POST); request.Resource = "Customer/{id}.json"; request.AddParameter("id", customer.CustomerID, ParameterType.UrlSegment); request.AddJsonBody(customer); return JsonStore.Execute(request); } } }