Advertisement
Guest User

Untitled

a guest
May 17th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1. @model PILG_POU.Models.CourseModel
  2. @*
  3. *@
  4. @{
  5. ViewData["Title"] = "Перечень оказываемых услуг";
  6. ViewData["format1"] = ".jpg";
  7. ViewData["format2"] = ".docx";
  8. }
  9. <h2 class="hh2">@ViewData["Title"]</h2>
  10. <h3 class="hh3">@ViewData["Message"]</h3>
  11.  
  12.  
  13. @if (!User.Identity.IsAuthenticated)
  14. {
  15. <div class="p_ab">
  16. <a href="http://localhost:49462/Register">Зарегистрируйтесь</a> или <a href="http://localhost:49462/Login">войдите</a><label>, чтобы добавить курс в "сумку"!</label>
  17. </div><br />
  18. }
  19.  
  20. @if (User.IsInRole("admin"))
  21. {
  22. <div class="p_ab">
  23. <a href="http://localhost:49462/AddCourse">Добавить курс</a>
  24. </div><br />
  25. }
  26.  
  27. <table class="crstable">
  28. <tr> <th width="16%">Название курса</th><th width="8%">Возраст</th><th width="10%">Преподаватель</th><th width="28%">Описание курса</th><th width="7%">Период</th><th width="7%">Цена курса</th></tr>
  29. </table>
  30. @foreach (var curs in ViewBag.Courses)
  31. {
  32.  
  33. @if (User.Identity.IsAuthenticated)
  34. {
  35. if (User.Identity.Name == "admin")
  36. {
  37. /*скрыть курс*/
  38. <a asp-controller="Home" asp-action="HideCourse" asp-route-id="@curs.Id">
  39. @if (!curs.Hidden)
  40. {<span>Показать</span>}
  41. else
  42. {<span>Скрыть</span> }
  43. </a>
  44. /*удалить курс*/
  45. <a asp-controller="Home" asp-action="DeleteCourse" asp-route-id="@curs.Id">
  46. <span>Удалить</span>
  47. </a>
  48. /*редактировать курс*/
  49. <a asp-controller="Home" asp-action="EditCourse" asp-route-id="@curs.Id">
  50. <span>Правка</span><br />
  51. </a>
  52.  
  53. }
  54. @if (ViewBag.EditCrsId == curs.Id)
  55. {
  56. <form>
  57. <div class="main">
  58. <textarea hidden asp-for="Id">@curs.Id</textarea>
  59. <div class="p_ab">
  60. <textarea class="lbl" asp-for="CourseName" required></textarea>
  61. <textarea class="lbl" asp-for="CourseOld" required></textarea>
  62. <textarea class="lbl" asp-for="CourseDescription" required></textarea>
  63. <textarea class="lbl" asp-for="CourseTime" required></textarea>
  64. <textarea class="lbl" asp-for="CourseCost" required></textarea>
  65. </div> <br />
  66.  
  67. <input class="btn" type="submit" value="Отправить" asp-controller="Home" asp-action="SaveCourse">
  68. </div><br />
  69. </form>
  70. }
  71. else
  72. {
  73. @if (!curs.Hidden && !User.IsInRole("admin"))
  74. {
  75. <table class="crstable">
  76. <tr><td width="16%">@curs.CourseName</td><td width="8%">@curs.CourseOld</td><td width="10%"></td><td width="28%">@curs.CourseDescription<br /></td><td width="7%">@curs.CourseTime</td><td width="7%">@curs.CourseCost</td></tr>
  77. </table>}
  78. }
  79.  
  80. }
  81. else if (User.IsInRole("user"))
  82. {
  83. /*добавить в корзину*/
  84. < a asp - controller = "Home" asp - action = "AddProduct" asp - route - id = "@curs.Id" >
  85. @*тут надо что-то дописать!!!*@
  86. < span > Положить в сумку</ span >
  87.  
  88. </ a >
  89.  
  90. < table class="crstable">
  91. <tr> <td width = "16%" > @curs.CourseName </ td >< td width="8%">@curs.CourseOld</td><td width = "10%" > @curs.CourseTeacher </ td >< td width="28%">@curs.CourseDescription<br /></td><td width = "7%" > @curs.CourseTime </ td >< td width="7%">@curs.CourseCost</td></tr>
  92. </table>
  93. }
  94. else if (User.IsInRole("manager"))
  95. {
  96. <table class="crstable">
  97. <tr> <td width = "16%" > @curs.CourseName </ td >< td width="8%">@curs.CourseOld</td><td width = "10%" > @curs.CourseTeacher </ td >< td width="28%">@curs.CourseDescription<br /></td><td width = "7%" > @curs.CourseTime </ td >< td width="7%">@curs.CourseCost</td></tr>
  98. </table>
  99.  
  100. }
  101.  
  102. }
  103. else {
  104.  
  105. <table class="crstable">
  106. <tr> <td width="16%">@curs.CourseName</td><td width="8%">@curs.CourseOld</td><td width="10">@curs.CourseTeacher</td><td width="28%">@curs.CourseDescription<br /></td><td width="7%">@curs.CourseTime</td><td width="7%">@curs.CourseCost</td></tr>
  107. </table>
  108.  
  109. }
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement