本文整理汇总了C#中IOwinContext.WriteJson方法的典型用法代码示例。如果您正苦于以下问题:C# IOwinContext.WriteJson方法的具体用法?C# IOwinContext.WriteJson怎么用?C# IOwinContext.WriteJson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOwinContext
的用法示例。
在下文中一共展示了IOwinContext.WriteJson方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRoleDetails
private async Task GetRoleDetails(IOwinContext context)
{
var key = new RoleKey(context.GetRouteValue("key"));
var role = _collectionsReadModel.Roles.Single(r => r.Key == key);
await context.WriteJson(role, _settings);
}
示例2: GetUserDetails
private async Task GetUserDetails(IOwinContext context)
{
var key = new UserKey(context.GetRouteValue("key"));
var user = _collectionsReadModel.Users.Single(r => r.Key == key);
await context.WriteJson(user, _settings);
}
示例3: GetPermissionDetails
private async Task GetPermissionDetails(IOwinContext context)
{
var key = new PermissionKey(context.GetRouteValue("key"));
var permission = _collectionsReadModel.Permissions.Single(p => p.Key == key);
await context.WriteJson(permission, _settings);
}
示例4: GetAll
private async Task GetAll(IOwinContext context)
{
await context.WriteJson(_collectionsReadModel.Roles, _settings);
}
示例5: GetAllHistory
private async Task GetAllHistory(IOwinContext context)
{
await context.WriteJson(_history.Entries, _settings);
}
示例6: CheckPermission
private async Task CheckPermission(IOwinContext context)
{
var userKey = new UserKey(context.GetRouteValue("user-key"));
var permissionKey = new PermissionKey(context.GetRouteValue("permission-key"));
var user = _collectionsReadModel.Users.Single(u => u.Key == userKey);
var permission = _collectionsReadModel.Permissions.Single(p => p.Key == permissionKey);
var result = new
{
Allowed = _authReadModel.CanUserPerformAction(user.ID, permission.ID)
};
await context.WriteJson(result, _settings);
}