예제 #1
0
 public async override Task Compensate(SagaContext <string> context)
 {
     if (((IDictionary <string, object>)context.Data).ContainsKey("Plan"))
     {
         await roleAssigner.RemoveRole(context.Data.User, (Guid)context.Data.Plan.roleId);
     }
     else
     {
         await roleAssigner.RemoveRole(context.Data.User, "Free");
     }
 }
예제 #2
0
        public async override Task Execute(RemoveRoleFromUserCommand input, User?user)
        {
            var userToRemoveFrom = await userRepo.FindById(input.UserId) ?? throw new EntityNotFoundException();

            await roleAssigner.RemoveRole(userToRemoveFrom, input.RoleId);
        }