Advertisement
Guest User

Untitled

a guest
Feb 26th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. @using WebPatient.Models
  2. @model IEnumerable<Patient>
  3. @Scripts.Render("~/bundles/jquery")
  4. @{
  5. ViewBag.Title = "Пациенты";
  6. }
  7.  
  8. @section featured {
  9. <section class="featured">
  10. <div>
  11. <table id="PatientsTable" class="table">
  12. <tr>
  13. <th>ФИО</th>
  14. <th>@Html.DisplayNameFor(m => m.Gender)</th>
  15. <th>Возраст</th>
  16. <th>@Html.DisplayNameFor(m => m.Snils)</th>
  17. <th>Редактирование</th>
  18. </tr>
  19.  
  20. @foreach (var item in Model)
  21. {
  22. <tr>
  23. <td>@item.LastName @item.FirstName @item.MiddleName</td>
  24. <td>@item.Gender.ToString()</td>
  25. <td>@Math.Truncate(DateTime.Now.Subtract(item.DateOfBirth).TotalDays / 365)</td>
  26. <td>@item.Snils</td>
  27. <td><a href="#" onclick="editPatient(@item.PatientID)" class="btn btn-primary">Редактировать</a></td>
  28. </tr>
  29. }
  30.  
  31. </table>
  32. </div>
  33. </section>
  34. }
  35. <script>
  36. $(function () {
  37. $('.editModal').modal();
  38. });
  39.  
  40. function editPatient(patientID) {
  41. $.ajax({
  42. url: '/Home/GetPatientsModal/', // The method name + paramater
  43. data: {
  44. PatientID: patientID
  45. },
  46. success: function (data) {
  47. $('#modalWrapper').html(data); // This should be an empty div where you can inject your new html (the partial view)
  48. }
  49. });
  50. }
  51. </script>
  52.  
  53. <div id="modalWrapper">
  54. @* Inject form here *@
  55. </div>
  56.  
  57. <!-- Modal -->
  58. <div id="myModal" class="modal fade" role="dialog">
  59. <div class="modal-dialog">
  60.  
  61. <!-- Modal content-->
  62. <div class="modal-content">
  63. <div class="modal-header">
  64. <button type="button" class="close" data-dismiss="modal">&times;</button>
  65. <h4 class="modal-title">Modal Header</h4>
  66. </div>
  67. <div class="modal-body">
  68. <p>Some text in the modal.</p>
  69. </div>
  70. <div class="modal-footer">
  71. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  72. </div>
  73. </div>
  74.  
  75. </div>
  76. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement