Browse Source

Use ObjectMapper for NewEntity and EditingEntity

pull/5973/head
Mladen Macanovic 6 years ago
parent
commit
157d7b1d6e
  1. 14
      framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs

14
framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs

@ -318,7 +318,11 @@ namespace Volo.Abp.BlazoriseUI
{
await CheckCreatePolicyAsync();
NewEntity.ResetState();
ObjectMapper.Map(new TCreateViewModel(), NewEntity);
// Mapper will not notify Blazor that binded values are changed
// so we need to notify it manually by calling StateHasChanged
await InvokeAsync(() => StateHasChanged());
CreateModal.Show();
}
@ -334,8 +338,12 @@ namespace Volo.Abp.BlazoriseUI
await CheckUpdatePolicyAsync();
var entityDto = await AppService.GetAsync(id);
EditingEntityId = id;
EditingEntity.ApplyState(MapToEditingEntity(entityDto));
ObjectMapper.Map(entityDto, EditingEntity);
await InvokeAsync(() => StateHasChanged());
EditModal.Show();
}
@ -379,8 +387,6 @@ namespace Volo.Abp.BlazoriseUI
CreateModal.Hide();
}
protected virtual async Task UpdateEntityAsync()
{
await CheckUpdatePolicyAsync();

Loading…
Cancel
Save