当前位置: 首页>>代码示例>>C#>>正文


C# IOwinContext.ReadJson方法代码示例

本文整理汇总了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();
		}
开发者ID:Pondidum,项目名称:Magistrate,代码行数:11,代码来源:UsersController.cs

示例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();
		}
开发者ID:Pondidum,项目名称:Magistrate,代码行数:11,代码来源:RolesController.cs

示例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();
		}
开发者ID:Pondidum,项目名称:Magistrate,代码行数:12,代码来源:UsersController.cs

示例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();
		}
开发者ID:Pondidum,项目名称:Magistrate,代码行数:13,代码来源:RolesController.cs

示例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();
		}
开发者ID:Pondidum,项目名称:Magistrate,代码行数:15,代码来源:RolesController.cs

示例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();
		}
开发者ID:Pondidum,项目名称:Magistrate,代码行数:15,代码来源:PermissionsController.cs

示例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();
		}
开发者ID:Pondidum,项目名称:Magistrate,代码行数:18,代码来源:RolesController.cs

示例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();
		}
开发者ID:Pondidum,项目名称:Magistrate,代码行数:15,代码来源:UsersController.cs

示例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();
		}
开发者ID:Pondidum,项目名称:Magistrate,代码行数:18,代码来源:UsersController.cs

示例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();
		}
开发者ID:Pondidum,项目名称:Magistrate,代码行数:18,代码来源:UsersController.cs


注:本文中的IOwinContext.ReadJson方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。