Guest User

Untitled

a guest
Nov 24th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. public class CarListViewModel
  2. {
  3. public List<Car> cars{ get; set; }
  4. public int selectedCar { get; set; }
  5. public List<Material> materials { get; set; }
  6.  
  7. // (...)
  8. }
  9.  
  10. public class Material
  11. {
  12. public string name { get; set; }
  13. public string lot { get; set; }
  14. public int quantity { get; set; }
  15. }
  16.  
  17. @model CarListViewModel
  18.  
  19. @{
  20. ViewData["Title"] = "Registar material";
  21. }
  22.  
  23. <div class="material-registration-wrapper">
  24. <h2 class="title">Registo materiais - Carro</h2>
  25.  
  26. @using (Html.BeginForm("MaterialDummy", "Material", FormMethod.Post, new { id = "materialRegistrationForm" }))
  27. {
  28. <table class="material-registration-insertion">
  29. <tr>
  30. <th>Material</th>
  31. <th>Lote</th>
  32. <th>Quantidade</th>
  33. </tr>
  34. <tr>
  35. @{List<Material> mList = new List<Material>();}
  36. @{Material m1 = new Material();}
  37. <td>@Html.TextBoxFor(model => m1.name, null, new { type = "text" })</td>
  38. <td>@Html.TextBoxFor(model => m1.lot, null, new { type = "text" })</td>
  39. <td>@Html.TextBoxFor(model => m1.quantity, null, new { type = "text" })</td>
  40. </tr>
  41. <tr>
  42. @{Material m2 = new Material();}
  43. <td>@Html.TextBoxFor(model => m2.name, null, new { type = "text" })</td>
  44. <td>@Html.TextBoxFor(model => m2.lot, null, new { type = "text" })</td>
  45. <td>@Html.TextBoxFor(model => m2.quantity, null, new { type = "text" })</td>
  46. </tr>
  47. <tr>
  48. @{Material m3 = new Material();}
  49. <td>@Html.TextBoxFor(model => m3.name, null, new { type = "text" })</td>
  50. <td>@Html.TextBoxFor(model => m3.lot, null, new { type = "text" })</td>
  51. <td>@Html.TextBoxFor(model => m3.quantity, null, new { type = "text" })</td>
  52. </tr>
  53. @{ mList.Add(m1); }
  54. @{ mList.Add(m2); }
  55. @{ mList.Add(m3); }
  56. @Html.HiddenFor(model => mList, Model.materials)
  57. </table>
  58. <table class="submit-table">
  59. <tr>
  60. <td>
  61. <div class="submit-table">
  62. <input type="submit" value="Submeter" class="submit-button" />-->
  63. </div>
  64. </td>
  65. </tr>
  66. </table>
  67. }
  68. </div>
  69.  
  70. <table class="material-registration-insertion">
  71. <tr>
  72. <th>Material</th>
  73. <th>Lote</th>
  74. <th>Quantidade</th>
  75. </tr>
  76. <tr>
  77. <td>@Html.TextBoxFor(model => model.materials[0].name, null, new { type = "text" })</td>
  78. <td>@Html.TextBoxFor(model => model.materials[0].lot, null, new { type = "text" })</td>
  79. <td>@Html.TextBoxFor(model => model.materials[0].quantity, null, new { type = "text" })</td>
  80. </tr>
  81. <tr>
  82. <td>@Html.TextBoxFor(model => model.materials[1].name, null, new { type = "text" })</td>
  83. <td>@Html.TextBoxFor(model => model.materials[1].lot, null, new { type = "text" })</td>
  84. <td>@Html.TextBoxFor(model => model.materials[1].quantity, null, new { type = "text" })</td>
  85. </tr>
  86. <tr>
  87. <td>@Html.TextBoxFor(model => model.materials[2].name, null, new { type = "text" })</td>
  88. <td>@Html.TextBoxFor(model => model.materials[2].lot, null, new { type = "text" })</td>
  89. <td>@Html.TextBoxFor(model => model.materials[2].quantity, null, new { type = "text" })</td>
  90. </tr>
  91. </table>
Add Comment
Please, Sign In to add comment