本文整理汇总了C#中IOwinContext.ReadJson方法的典型用法代码示例。如果您正苦于以下问题:C# IOwinContext.ReadJson方法的具体用法?C# IOwinContext.ReadJson怎么用?C# IOwinContext.ReadJson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOwinContext
的用法示例。
在下文中一共展示了IOwinContext.ReadJson方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteUser
private async Task DeleteUser(IOwinContext context)
{
var op= context.GetOperator();
context
.ReadJson<UserKey[]>()
.Select(key => _collectionsReadModel.Users.Single(p => p.Key == key))
.ForEach(u => _mediator.Publish(new DeleteUserCommand(op, u.ID)));
await Task.Yield();
}
示例2: DeleteRole
private async Task DeleteRole(IOwinContext context)
{
var user = context.GetOperator();
context
.ReadJson<RoleKey[]>()
.Select(key => _collectionsReadModel.Roles.Single(p => p.Key == key))
.ForEach(p => _mediator.Publish(new DeleteRoleCommand(user, p.ID)));
await Task.Yield();
}
示例3: CreateUser
private async Task CreateUser(IOwinContext context)
{
var dto = context.ReadJson<CreateUserDto>();
_mediator.Publish(new CreateUserCommand(
context.GetOperator(),
dto.Key,
dto.Name
));
await Task.Yield();
}
示例4: CreateRole
private async Task CreateRole(IOwinContext context)
{
var dto = context.ReadJson<CreateRoleDto>();
_mediator.Publish(new CreateRoleCommand(
context.GetOperator(),
dto.Key,
dto.Name,
dto.Description
));
await Task.Yield();
}
示例5: UpdateRoleName
private async Task UpdateRoleName(IOwinContext context)
{
var key = new RoleKey(context.GetRouteValue("key"));
var dto = context.ReadJson<EditRoleDto>();
var role = _collectionsReadModel.Roles.Single(r => r.Key == key);
_mediator.Publish(new ChangeRoleNameCommand(
context.GetOperator(),
role.ID,
dto.Name
));
await Task.Yield();
}
示例6: UpdatePermissionName
private async Task UpdatePermissionName(IOwinContext context)
{
var key = new PermissionKey(context.GetRouteValue("key"));
var dto = context.ReadJson<EditPermissionDto>();
var permission = _collectionsReadModel.Permissions.Single(p => p.Key == key);
_mediator.Publish(new ChangePermissionNameCommand(
context.GetOperator(),
permission.ID,
dto.Name
));
await Task.Yield();
}
示例7: RemovePermissions
private async Task RemovePermissions(IOwinContext context)
{
var key = new RoleKey(context.GetRouteValue("key"));
var role = _collectionsReadModel.Roles.Single(r => r.Key == key);
var permissions = context
.ReadJson<PermissionKey[]>()
.Select(pk => _collectionsReadModel.Permissions.Single(p => p.Key == pk))
.Select(p => p.ID);
_mediator.Publish(new RemovePermissionsFromRoleCommand(
context.GetOperator(),
role.ID,
permissions
));
await Task.Yield();
}
示例8: UpdateUserName
private async Task UpdateUserName(IOwinContext context)
{
var key = new UserKey(context.GetRouteValue("key"));
var dto = context.ReadJson<EditUserDto>();
var user = _collectionsReadModel.Users.Single(r => r.Key == key);
_mediator.Publish(new ChangeUserNameCommand(
context.GetOperator(),
user.ID,
dto.Name
));
await Task.Yield();
}
示例9: RemoveRole
private async Task RemoveRole(IOwinContext context)
{
var key = new UserKey(context.GetRouteValue("key"));
var user = _collectionsReadModel.Users.Single(r => r.Key == key);
var permissions = context
.ReadJson<RoleKey[]>()
.Select(rk => _collectionsReadModel.Roles.Single(p => p.Key == rk))
.Select(r => r.ID);
_mediator.Publish(new RemoveRolesFromUserCommand(
context.GetOperator(),
user.ID,
permissions
));
await Task.Yield();
}
示例10: AddRevoke
private async Task AddRevoke(IOwinContext context)
{
var key = new UserKey(context.GetRouteValue("key"));
var user = _collectionsReadModel.Users.Single(r => r.Key == key);
var permissions = context
.ReadJson<PermissionKey[]>()
.Select(pk => _collectionsReadModel.Permissions.Single(p => p.Key == pk))
.Select(p => p.ID);
_mediator.Publish(new AddRevokesToUserCommand(
context.GetOperator(),
user.ID,
permissions
));
await Task.Yield();
}