fixed update method

This commit is contained in:
2020-10-03 22:34:54 +02:00
parent 0aea91a59c
commit bee1d4b1e1
6 changed files with 28 additions and 28 deletions

View File

@ -39,7 +39,7 @@ namespace UserService.Pages
protected override async Task OnInitializedAsync()
{
OrganizationUnits = (await OuRepository.GetAllAsync().ConfigureAwait(false))
.Where(x => x.Parent is null)
.Where(x => x.ParentId is null)
.ToList();
}

View File

@ -39,7 +39,7 @@ namespace UserService.Pages
if (arg is null) throw new ArgumentNullException(nameof(arg));
var user = arg.Item;
await UsersRepository.AddAsync(user).ConfigureAwait(false);
user.Parent = OrganizationUnits?.FirstOrDefault(x => x.Id == user.ParentId);
//user.Parent = OrganizationUnits?.FirstOrDefault(x => x.Id == user.ParentId);
}
protected override async Task RowDeletingCallback(CancellableRowChange<User> arg)
@ -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 == (Guid?)arg.Values[nameof(Node.ParentId)]);
user.ParentId = (int?)arg.Values[nameof(Node.ParentId)];
var result = await UsersRepository.UpdateAsync(user).ConfigureAwait(false);
arg.Cancel = !result;
}