41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
|
using RestSharp;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using Tanshu.Accounts.Entities;
|
|||
|
|
|||
|
namespace Tanshu.Accounts.Repository
|
|||
|
{
|
|||
|
public static class RoleBI
|
|||
|
{
|
|||
|
public static IList<Role> List()
|
|||
|
{
|
|||
|
var request = new RestRequest();
|
|||
|
request.Resource = "Roles.json";
|
|||
|
return JsonStore.Execute<List<Role>>(request);
|
|||
|
}
|
|||
|
|
|||
|
public static Role Get(Guid id)
|
|||
|
{
|
|||
|
var request = new RestRequest();
|
|||
|
request.Resource = "Role/{id}.json";
|
|||
|
request.AddParameter("id", id, ParameterType.UrlSegment);
|
|||
|
return JsonStore.Execute<Role>(request);
|
|||
|
}
|
|||
|
|
|||
|
public static IList<Permission> Permissions()
|
|||
|
{
|
|||
|
var request = new RestRequest();
|
|||
|
request.Resource = "Permissions.json";
|
|||
|
return JsonStore.Execute<List<Permission>>(request);
|
|||
|
}
|
|||
|
public static Role Update(Role role)
|
|||
|
{
|
|||
|
var request = new RestRequest(Method.POST);
|
|||
|
request.Resource = "Role/{id}.json";
|
|||
|
request.AddParameter("id", role.RoleID, ParameterType.UrlSegment);
|
|||
|
request.AddJsonBody(role);
|
|||
|
return JsonStore.Execute<Role>(request);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|