Moved from int id to guid

This commit is contained in:
2020-09-08 20:10:56 +02:00
parent 05efdf51de
commit 31ef9bf45b
16 changed files with 221 additions and 216 deletions

View File

@ -74,10 +74,10 @@ else
}
</DisplayTemplate>
<EditTemplate>
<Select TValue="int?" SelectedValue="@((int?)(context.CellValue))" SelectedValueChanged="@(v => context.CellValue = v)" >
<Select TValue="Guid?" SelectedValue="@((Guid?)(context.CellValue))" SelectedValueChanged="@(v => context.CellValue = v)" >
@foreach (var item in OrganizationUnits ?? Enumerable.Empty<OrganizationUnit>())
{
<SelectItem TValue="int" Value="@(item.Id)">@item.CommonName</SelectItem>
<SelectItem TValue="Guid" Value="@(item.Id)">@item.CommonName</SelectItem>
}
</Select>
</EditTemplate>
@ -128,25 +128,29 @@ else
<TableHeaderCell></TableHeaderCell>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableRowHeader>1</TableRowHeader>
<TableRowCell>Mark</TableRowCell>
<TableRowCell>
<Button Color="Color.Danger">Delete</Button>
</TableRowCell>
</TableRow>
<TableRow>
<TableRowHeader>2</TableRowHeader>
<TableRowCell>Jacob</TableRowCell>
<TableRowCell><Button>Delete</Button></TableRowCell>
</TableRow>
<TableRow>
<TableRowHeader>3</TableRowHeader>
<TableRowCell>Larry</TableRowCell>
<TableRowCell><Button>Delete</Button></TableRowCell>
</TableRow>
</TableBody>
<TableBody>
@foreach (var member in SelectedSecurityGroup?.Members ?? Enumerable.Empty<MembersMember>())
{
<TableRow>
<TableRowHeader>@member.MemberId</TableRowHeader>
<TableRowCell>Mark</TableRowCell>
<TableRowCell>
<Button Color="Color.Danger">Delete</Button>
</TableRowCell>
</TableRow>
}
<TableRow>
<TableRowHeader>2</TableRowHeader>
<TableRowCell>Jacob</TableRowCell>
<TableRowCell><Button>Delete</Button></TableRowCell>
</TableRow>
<TableRow>
<TableRowHeader>3</TableRowHeader>
<TableRowCell>Larry</TableRowCell>
<TableRowCell><Button>Delete</Button></TableRowCell>
</TableRow>
</TableBody>
</Table>
</Column>
</Row>

View File

@ -15,7 +15,7 @@ namespace UserService.Pages
[Inject] private ISecurityGroupsRepository SecurityGroupsRepository { get; set; } = null!;
[Inject] private IUsersRepository UsersRepository { get; set; } = null!;
[Inject] private IOrganizationUnitsRepository OrganizationUnitsRepository { get; set; } = null!;
// reference to the modal component
@ -57,7 +57,7 @@ namespace UserService.Pages
var securityGroup = arg.Item;
securityGroup.MapFields(arg.Values);
securityGroup.Parent =
OrganizationUnits?.FirstOrDefault(x => x.Id == (int?) arg.Values[nameof(Node.ParentId)]);
OrganizationUnits?.FirstOrDefault(x => x.Id == (Guid?)arg.Values[nameof(Node.ParentId)]);
var result = await SecurityGroupsRepository.UpdateAsync(securityGroup).ConfigureAwait(false);
arg.Cancel = !result;
}
@ -89,14 +89,14 @@ namespace UserService.Pages
}
protected async Task AddToListAsync()
{
//SelectedSecurityGroup.Members.Add(new UserMember());
}
protected async Task AddToListAsync()
{
//SelectedSecurityGroup.Members.Add(new UserMember());
}
protected void OnButtonClicked(SecurityGroup securityGroup)
protected void OnButtonClicked(SecurityGroup securityGroup)
{
SelectedSecurityGroup = securityGroup;
ModalRef.Show();

View File

@ -90,10 +90,10 @@ else
}
</DisplayTemplate>
<EditTemplate>
<Select TValue="int?" SelectedValue="@((int?)(context.CellValue))" SelectedValueChanged="@(v => context.CellValue = v)" >
<Select TValue="Guid?" SelectedValue="@((Guid?)(context.CellValue))" SelectedValueChanged="@(v => context.CellValue = v)" >
@foreach (var item in OrganizationUnits ?? Enumerable.Empty<OrganizationUnit>())
{
<SelectItem TValue="int" Value="@(item.Id)">@item.CommonName</SelectItem>
<SelectItem TValue="Guid" Value="@(item.Id)">@item.CommonName</SelectItem>
}
</Select>
</EditTemplate>

View File

@ -71,7 +71,7 @@ namespace UserService.Pages
if (arg == null) throw new ArgumentNullException(nameof(arg));
var user = arg.Item;
user.MapFields(arg.Values);
user.Parent = OrganizationUnits?.FirstOrDefault(x => x.Id == (int?)arg.Values[nameof(Node.ParentId)]);
user.Parent = OrganizationUnits?.FirstOrDefault(x => x.Id == (Guid?)arg.Values[nameof(Node.ParentId)]);
var result = await UsersRepository.UpdateAsync(user).ConfigureAwait(false);
arg.Cancel = !result;
}