Esempio n. 1
0
        public async Task UpdateAsync(long id, UpdateGroupDto updateGroupDto)
        {
            LinGroup group = await _groupRepository.Where(r => r.Id == id).FirstAsync();

            Mapper.Map(updateGroupDto, group);
            await _groupRepository.UpdateAsync(group);
        }
Esempio n. 2
0
 public async Task UpdateAsync(long id, UpdateGroupDto updateGroupDto)
 {
     await _groupRepository.UpdateDiy.Where(r => r.Id == id).Set(a => new LinGroup()
     {
         Info = updateGroupDto.Info,
         Name = updateGroupDto.Name
     }).ExecuteAffrowsAsync();
 }
Esempio n. 3
0
        public async Task UpdateAsync(long id, UpdateGroupDto updateGroupDto)
        {
            LinGroup group = await _groupRepository.Where(r => r.Id == id).FirstAsync();

            if (group.IsStatic)
            {
                if (group.Name != updateGroupDto.Name)
                {
                    throw new LinCmsException("静态权限组标识符不修改!");
                }
            }

            bool anyName = await _groupRepository.Where(r => r.Name == updateGroupDto.Name && r.Id != id).AnyAsync();

            if (anyName)
            {
                throw new LinCmsException($"权限组标识符:{updateGroupDto.Name}已存在!", ErrorCode.RepeatField);
            }

            Mapper.Map(updateGroupDto, group);
            await _groupRepository.UpdateAsync(group);
        }