source: PostgreSqlDotnetCore/Views/Blog/Index.cshtml@ 118e414

main
Last change on this file since 118e414 was 118e414, checked in by ElenaMoskova <elena.moskova99@…>, 5 weeks ago

fix access

implement multiple access pages with different roles
optimize present three structure of BlogPost and Answer

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[2aea0fd]1@model IEnumerable<PostgreSqlDotnetCore.Models.BlogPostConsultation>
2
3@{
4 ViewBag.Title = "BlogPostConsultation";
5}
6
7<h2>Blog post for consultations.</h2>
8
9<p>
10 @Html.ActionLink("Ask for Advice", "Create")
11</p>
12<table class="table">
13 <tr>
14
15 <th>
16 @Html.DisplayNameFor(model => model.date_askes)
17 </th>
18 <th>
19 @Html.DisplayNameFor(model => model.title)
20 </th>
21 <th>
22 @Html.DisplayNameFor(model => model.description)
23 </th>
24 <th>
25 @Html.DisplayNameFor(model => model.users_id)
26 </th>
27 <th></th>
28
29 </tr>
30
[118e414]31 @foreach (var item in Model)
32 {
33 <tr>
34 <td>
35 @Html.DisplayFor(modelItem => item.date_askes)
36 </td>
37 <td>
38 @Html.DisplayFor(modelItem => item.title)
39 </td>
40
41 <td>
42 @Html.DisplayFor(modelItem => item.description)
43 </td>
44 <th>
45 @Html.DisplayFor(model => item.users_id)
46 </th>
47
48 @*<td>
49 @Html.ActionLink("Edit", "Edit", new { id = item.id }) |
50 @Html.ActionLink("Answers", "Details", new { id = item.id }) |
51 @Html.ActionLink("Delete", "Delete", new { id = item.id })
[2aea0fd]52 </td>
[118e414]53 *@
[2aea0fd]54
55
[72b1da2]56
57
[118e414]58 @if (item.users_id == ViewBag.CurrentUserId)
59 {
60 <td>
61 @Html.ActionLink("Edit", "Edit", new { id = item.id })
62 @Html.ActionLink("Delete", "Delete", new { id = item.id })
[72b1da2]63
[118e414]64 </td>
[72b1da2]65 }
66
67
68 @if (item.users_id == ViewBag.CurrentUserId || item.users_id != ViewBag.CurrentUserId)
69 {
70 <td>
[118e414]71
72 @Html.ActionLink("Answers", "Details", new { id = item.id })
73
[72b1da2]74
75 </td>
76 }
77
78
[118e414]79
80
81
82
83 </tr>
84 }
[2aea0fd]85
86</table>
Note: See TracBrowser for help on using the repository browser.