zhengyuxuan
2025-03-28 d6ffbd97603decf4d3922a697414f4f7cec30434
LifePayment/LifePayment.Application/User/UserRoleService.cs
@@ -103,10 +103,16 @@
            List<UserChannle> userChannles = new List<UserChannle>();
            foreach (var item in input.ChannlesId)
            {
                var channleNum = item;
                if (IsGuid(channleNum))
                {
                    channleNum = await _channleRepository.Where(x => x.Id == Guid.Parse(item)).Select(s => s.ChannlesNum).FirstOrDefaultAsync();
                }
                userChannles.Add(new UserChannle()
                {
                    Id = Guid.NewGuid(),
                    ChannleId = item,
                    ChannleId = channleNum,
                    UserId = entity.Id
                });
            }
@@ -221,5 +227,11 @@
            await _roleRepository.DeleteAsync(id);
            return Constant.SUCCESS;
        }
        private bool IsGuid(string input)
        {
            Guid guidOutput;
            return Guid.TryParse(input, out guidOutput);
        }
    }
}
}