Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. @model ProviderViewModel
  2. <form asp-action="Create">
  3. <div>
  4. @Html.LabelFor(m => m.Name)
  5. @Html.TextBoxFor(m => m.Name)
  6. </div>
  7. <div>
  8. @Html.LabelFor(m => m.Url)
  9. @Html.TextBoxFor(m => m.Url)
  10. </div>
  11. <div>
  12. @Html.Label("Attributes")
  13. </div>
  14. @if (Model.Attributes.Count > 0)
  15. {
  16. @for (var i = 0; i < Model.Attributes.Count; i++)
  17. {
  18. @await Html.PartialAsync("_ProviderAttribute", Model.Attributes[i])
  19. }
  20. }
  21. <div>
  22. <input type="submit" value="+" formaction="AddAttribute" formmethod="post" />
  23. </div>
  24. <br/>
  25. </form>
  26.  
  27. [HttpPost]
  28. public IActionResult AddAttribute(ProviderViewModel provider)
  29. {
  30. provider.Attributes.Add(new AttributeViewModel
  31. {
  32. Guid = Guid.NewGuid().ToString()
  33. });
  34. return View(nameof(Provider), provider);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement