tenant management - implement concurrency stamp

pull/9838/head
enisn 4 years ago
parent 9112f1f695
commit d45bf3da47

@ -1,10 +1,13 @@
using System;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
namespace Volo.Abp.TenantManagement
{
public class TenantDto : ExtensibleEntityDto<Guid>
public class TenantDto : ExtensibleEntityDto<Guid>, IHasConcurrencyStamp
{
public string Name { get; set; }
public string ConcurrencyStamp { get; set; }
}
}

@ -1,7 +1,9 @@
namespace Volo.Abp.TenantManagement
using Volo.Abp.Domain.Entities;
namespace Volo.Abp.TenantManagement
{
public class TenantUpdateDto : TenantCreateOrUpdateDtoBase
public class TenantUpdateDto : TenantCreateOrUpdateDtoBase, IHasConcurrencyStamp
{
public string ConcurrencyStamp { get; set; }
}
}

@ -98,9 +98,14 @@ namespace Volo.Abp.TenantManagement
public virtual async Task<TenantDto> UpdateAsync(Guid id, TenantUpdateDto input)
{
var tenant = await TenantRepository.GetAsync(id);
await TenantManager.ChangeNameAsync(tenant, input.Name);
tenant.SetConcurrencyStamp(input.ConcurrencyStamp);
input.MapExtraPropertiesTo(tenant);
await TenantRepository.UpdateAsync(tenant);
return ObjectMapper.Map<Tenant, TenantDto>(tenant);
}

@ -18,6 +18,7 @@
<abp-modal-header title="@L["Edit"].Value"></abp-modal-header>
<abp-modal-body>
<input asp-for="Tenant.Id" />
<input asp-for="Tenant.ConcurrencyStamp" />
<abp-input asp-for="Tenant.Name" label="@L["TenantName"].Value" />
@foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties<EditModalModel.TenantInfoModel>())
{

@ -2,6 +2,7 @@ using System;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Domain.Entities;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Validation;
@ -38,7 +39,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
return NoContent();
}
public class TenantInfoModel : ExtensibleObject
public class TenantInfoModel : ExtensibleObject, IHasConcurrencyStamp
{
[HiddenInput]
public Guid Id { get; set; }
@ -47,6 +48,9 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
[DynamicStringLength(typeof(TenantConsts), nameof(TenantConsts.MaxNameLength))]
[Display(Name = "DisplayName:TenantName")]
public string Name { get; set; }
[HiddenInput]
public string ConcurrencyStamp { get; set; }
}
}
}
Loading…
Cancel
Save