39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
@page "/profiles/import/{profileId:int}/steps/{stepId:int}/edit"
|
|
@using ECM.JobRunner.Common.JobRunnerReference;
|
|
@using ECM.JobRunner.Web.Data;
|
|
@inject NavigationManager Navigation;
|
|
@inject ImportService Profile;
|
|
|
|
<PageTitle>Schritt bearbeiten</PageTitle>
|
|
|
|
<h3>Schritt bearbeiten</h3>
|
|
|
|
<StepForm ProfileId="ProfileId" StepId="StepId" OnValidSubmit="OnFormSubmit" />
|
|
|
|
@code {
|
|
[Parameter]
|
|
public int ProfileId { get; set; }
|
|
|
|
[Parameter]
|
|
public int StepId { get; set; }
|
|
|
|
public ImportProfile? profile;
|
|
|
|
private async void OnFormSubmit(EditContext ctx)
|
|
{
|
|
ImportProfile profile = await Profile.GetProfile(ProfileId);
|
|
ImportProfileStep step = (ImportProfileStep)ctx.Model;
|
|
|
|
// TODO: This is ugly and manual and needs to be abstracted.
|
|
var index = profile.Steps.ToList().FindIndex(s => s.Id == StepId);
|
|
profile.Steps[index] = step;
|
|
|
|
bool result = await Profile.UpdateProfile(profile);
|
|
|
|
if (result == true)
|
|
{
|
|
Navigation.NavigateTo($"/profiles/import/{profile.Id}/steps");
|
|
}
|
|
}
|
|
}
|