Skip to content

Instantly share code, notes, and snippets.

@gavilanch
Created January 16, 2020 14:44
Show Gist options
  • Save gavilanch/ff4353df60f80f8ffa772091b57c29c6 to your computer and use it in GitHub Desktop.
Save gavilanch/ff4353df60f80f8ffa772091b57c29c6 to your computer and use it in GitHub Desktop.
<EditForm Model="Movie" OnValidSubmit="OnValidSubmit">
<div class="form-group">
<label>Genres:</label>
<div>
<MultipleSelector Selected="Selected" NoSelected="NotSelected"></MultipleSelector>
</div>
</div>
</EditForm>
@code {
[Parameter] public List<Genre> SelectedGenres { get; set; } = new List<Genre>();
[Parameter] public List<Genre> NotSelectedGenres { get; set; } = new List<Genre>();
private List<MultipleSelectorModel> Selected = new List<MultipleSelectorModel>();
private List<MultipleSelectorModel> NotSelected = new List<MultipleSelectorModel>();
protected override void OnInitialized()
{
Selected = SelectedGenres.Select(x => new MultipleSelectorModel(x.Id.ToString(), x.Name)).ToList();
NotSelected = NotSelectedGenres.Select(x => new MultipleSelectorModel(x.Id.ToString(), x.Name)).ToList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment