コード例 #1
0
        // DELETE: api/UserRole/5  detach a userRole, id is userId
        public async Task <HandleResult> Delete(string id, string roleId)
        {
            var command = new DetachUserRole(id, roleId);
            var result  = await ExecuteCommandAsync(command);

            if (result.IsSuccess())
            {
                return(HandleResult.FromSuccess("移除成功"));
            }
            return(HandleResult.FromFail(result.GetErrorMessage()));
        }
コード例 #2
0
 /// <summary>移除用户角色
 /// </summary>
 public void Handle(ICommandContext context, DetachUserRole command)
 {
     context.Get <User>(command.AggregateRootId).DetachUserRole(command.RoleId);
 }