mirror of https://github.com/abpframework/abp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.3 KiB
49 lines
1.3 KiB
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
|
|
|
|
namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
|
|
{
|
|
public class EditModalModel : AbpPageModel
|
|
{
|
|
[BindProperty]
|
|
public TenantInfoModel Tenant { get; set; }
|
|
|
|
private readonly ITenantAppService _tenantAppService;
|
|
|
|
public EditModalModel(ITenantAppService tenantAppService)
|
|
{
|
|
_tenantAppService = tenantAppService;
|
|
}
|
|
|
|
public async Task OnGetAsync(Guid id)
|
|
{
|
|
Tenant = ObjectMapper.Map<TenantDto, TenantInfoModel>(
|
|
await _tenantAppService.GetAsync(id)
|
|
);
|
|
}
|
|
|
|
public async Task<IActionResult> OnPostAsync()
|
|
{
|
|
ValidateModel();
|
|
|
|
var input = ObjectMapper.Map<TenantInfoModel, TenantUpdateDto>(Tenant);
|
|
await _tenantAppService.UpdateAsync(Tenant.Id, input);
|
|
|
|
return NoContent();
|
|
}
|
|
|
|
public class TenantInfoModel
|
|
{
|
|
[HiddenInput]
|
|
public Guid Id { get; set; }
|
|
|
|
[Required]
|
|
[StringLength(TenantConsts.MaxNameLength)]
|
|
[Display(Name = "TenantName")]
|
|
public string Name { get; set; }
|
|
}
|
|
}
|
|
} |