Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @model ProviderViewModel
- <form asp-action="Create">
- <div>
- @Html.LabelFor(m => m.Name)
- @Html.TextBoxFor(m => m.Name)
- </div>
- <div>
- @Html.LabelFor(m => m.Url)
- @Html.TextBoxFor(m => m.Url)
- </div>
- <div>
- @Html.Label("Attributes")
- </div>
- @if (Model.Attributes.Count > 0)
- {
- @for (var i = 0; i < Model.Attributes.Count; i++)
- {
- @await Html.PartialAsync("_ProviderAttribute", Model.Attributes[i])
- }
- }
- <div>
- <input type="submit" value="+" formaction="AddAttribute" formmethod="post" />
- </div>
- <br/>
- </form>
- [HttpPost]
- public IActionResult AddAttribute(ProviderViewModel provider)
- {
- provider.Attributes.Add(new AttributeViewModel
- {
- Guid = Guid.NewGuid().ToString()
- });
- return View(nameof(Provider), provider);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement