Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. @model List<Diplom.Models.ViewModel>
  2.  
  3. <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
  4.  
  5. @using (Ajax.BeginForm("CreditCPU", "Credit", new AjaxOptions() { HttpMethod = "POST", OnComplete = "sendPost" }))
  6. {
  7. <form>
  8. <section style="margin-top:30px">
  9. <div class="modal-content">
  10. <div class="modal-header">
  11. <h1>Введите данные</h1>
  12. </div>
  13. @if (Model.FirstOrDefault(x => x.id == 1).uniqId != 0)
  14. {
  15. <input class="form-control invisible" name="idCpu" value="@Model.FirstOrDefault(x => x.id == 1).uniqId" />
  16. }
  17. <div class="modal-body">
  18. <table class="table table-condensed table-striped table-bordered">
  19. <tr>
  20. <td>Наименование:</td>
  21. <td><input name="nameCpu" type="text" id="nameCpu" class="form-control" value="@Model.FirstOrDefault(x => x.id==1).Name"></td>
  22. </tr>
  23. <tr>
  24. <td>Разьем:</td>
  25. <td>
  26. <select name="socketid" id="socketid" class="form-control">
  27. @foreach (var item in Model)
  28. {
  29. if (item.socket != null)
  30. {
  31. <option value="@item.id" id="@item.id">@item.socket</option>
  32. }
  33. }
  34. </select>
  35. </td>
  36. </tr>
  37. <tr>
  38. <td>Ядер,шт:</td>
  39. <td><input type="text" name="cores" id="cores" class="form-control" value="@Model.FirstOrDefault(x => x.id==1).core"></td>
  40. </tr>
  41. <tr>
  42. <td>Стоимость</td>
  43. <td><input type="text" name="price" id="price" class="form-control" value="@Decimal.Round(Model.FirstOrDefault(x => x.id==1).price.GetValueOrDefault(),2)"></td>
  44. </tr>
  45. <tr>
  46. <td>Количество:</td>
  47. <td><input type="text" name="count" id="count" class="form-control" value="@Model.FirstOrDefault(x => x.id==1).count"></td>
  48. </tr>
  49. <tr>
  50. <td>Производитель:</td>
  51. <td>
  52. <select name="idManufacture" id="idManufacture" class="form-control">
  53. @foreach (var item in Model)
  54. {
  55. if (item.brand != null)
  56. {
  57. <option value="@item.id">@item.brand</option>
  58. }
  59. }
  60. </select>
  61. </td>
  62. </tr>
  63. </table>
  64. </div>
  65. <div class="modal-footer">
  66. <button class="btn btn-default" data-dismiss="modal">Закрыть</button>
  67. <button class="btn btn-primary cpuform" type="submit">Сохранить</button>
  68. </div>
  69. </div>
  70. </section>
  71. </form>
  72. }<script> $(document).ready(function () {
  73. $("#socketid").val(@Model.FirstOrDefault(x => x.id == 1).idsocket);
  74. });
  75.  
  76. $(document).ready(function () {
  77. $("#idManufacture").val(@Model.FirstOrDefault(x => x.id == 1).idbrand);
  78. });
  79.  
  80. <div id="modDialog" class="modal fade">
  81. <div id="dialogContent" class="modal-dialog"></div></div>
  82.  
  83. function sendPost(e) {
  84. $("#dialogContent").modal('hide');
  85. $("#modDialog").modal('hide');
  86. }
  87.  
  88. $('.modal').remove();
  89. $('.modal-backdrop').remove();
  90. $('body').removeClass("modal-open");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement