mh_custom/wtmProject.Shared/Pages/_Admin/FrameworkCustom/Edit.razor
2024-05-17 13:43:36 +08:00

44 lines
1.3 KiB
Plaintext

@page "/_Admin/FrameworkCustom/Edit/{id}"
@using wtmProject.ViewModel._Admin.FrameworkCustomVMs;
@inherits BasePage
<ValidateForm @ref="vform" Model="@Model" OnValidSubmit="@Submit">
<Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.Normal">
<BootstrapInput @bind-Value="@Model.Entity.CustomCode" />
<BootstrapInput @bind-Value="@Model.Entity.CustomName" />
</Row>
<div class="modal-footer table-modal-footer">
@*<Button Color="Color.Primary" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Close"]" OnClick="OnClose" />*@
<Button Color="Color.Primary" ButtonType="ButtonType.Submit" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Edit"]" IsAsync="true" />
</div>
</ValidateForm>
@code {
private FrameworkCustomVM Model = null;
private ValidateForm vform { get; set; }
[Parameter]
public string id { get; set; }
protected override async Task OnInitializedAsync()
{
var rv = await WtmBlazor.Api.CallAPI<FrameworkCustomVM>($"/api/FrameworkCustom/{id}");
Model = rv.Data;
await base.OnInitializedAsync();
}
private async Task Submit(EditContext context)
{
await PostsForm(vform, $"/api/FrameworkCustom/edit", (s) => "Sys.OprationSuccess", method: HttpMethodEnum.PUT);
}
public void OnClose()
{
CloseDialog();
}
}