public void UpdateGroup(GroupDto groupDto) { var group = GetGroup(groupDto.Id.Value); group.GroupName = groupDto.GroupName; group.Description = groupDto.Description; group.Email = groupDto.Email; group.EnabledEmail = groupDto.EnabledEmail; group.ParentGroupId = groupDto.ParentGroupId; if (groupDto.UsersIds != null) { var users = _dbContext.Users.Where(item => groupDto.UsersIds.Contains(item.Id)).ToList(); group.Users = users; } if (groupDto.ChildGroupsIds != null) { var childGroups = _dbContext.Groups.Where(item => groupDto.ChildGroupsIds.Contains(item.Id)).ToList(); group.ChildGroups = childGroups; } _dbContext.Update(group); _dbContext.SaveChanges(); }
public void UpdateUser(UserDto userDto) { _dbContext.Update(GetUser(userDto)); _dbContext.SaveChanges(); }