Ignore:
Timestamp:
08/23/24 15:40:14 (5 weeks ago)
Author:
ElenaMoskova <elena.moskova99@…>
Branches:
main
Children:
e9bb9d1
Parents:
72b1da2
Message:

fix access

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

Location:
PostgreSqlDotnetCore/Views/Blog
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • PostgreSqlDotnetCore/Views/Blog/Details.cshtml

    r72b1da2 r118e414  
    8080                    @Html.ActionLink("Details", "Details", "BlogPostAnswers", new { id = item.id }) |
    8181                    @Html.ActionLink("Delete", "Delete", "BlogPostAnswers", new { id = item.id })
     82
     83                    @Html.ActionLink("Create an Answer", "Create", "BlogPostAnswers", new { id = item.BlogPostConsultationid, parentId = item.id })
    8284                </td>
    8385            </tr>
     
    8789</div>
    8890<p>
     91    @Html.ActionLink("Create an Answer", "Create", "BlogPostAnswers", new { id = Model.id, parentId = Model.id })
    8992    @Html.ActionLink("Edit", "Edit", new { id = Model.id }) |
    9093    @Html.ActionLink("Back to List", "Index")
  • PostgreSqlDotnetCore/Views/Blog/Index.cshtml

    r72b1da2 r118e414  
    2929    </tr>
    3030
    31 @foreach (var item in Model) {
    32     <tr>
    33         <td>
    34             @Html.DisplayFor(modelItem => item.date_askes)
    35         </td>
    36         <td>
    37             @Html.DisplayFor(modelItem => item.title)
    38         </td>
     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>
    3940
    40         <td>
    41             @Html.DisplayFor(modelItem => item.description)
    42         </td>
    43         <th>
    44             @Html.DisplayFor(model => item.users_id)
    45         </th>
     41            <td>
     42                @Html.DisplayFor(modelItem => item.description)
     43            </td>
     44            <th>
     45                @Html.DisplayFor(model => item.users_id)
     46            </th>
    4647
    47        @*<td>
    48             @Html.ActionLink("Edit", "Edit", new { id = item.id }) |
    49             @Html.ActionLink("Answers", "Details", new { id = item.id }) |
    50             @Html.ActionLink("Delete", "Delete", new { id = item.id })
     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 })
    5152        </td>
    5253        *@
    53            
    5454
    5555
    5656
    57               @if (item.users_id == ViewBag.CurrentUserId)
    58               {
    59               <td>
    60             @Html.ActionLink("Edit", "Edit", new { id = item.id })
    61             @Html.ActionLink("Delete", "Delete", new { id = item.id })
    62              
    63         </td>
     57
     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 })
     63
     64                </td>
    6465            }
    6566
    66            
    6767
    6868            @if (item.users_id == ViewBag.CurrentUserId || item.users_id != ViewBag.CurrentUserId)
    6969            {
    7070                <td>
    71                    
    72                     @Html.ActionLink("Answers", "Details", new { id = item.id }) 
    73                    
     71
     72                    @Html.ActionLink("Answers", "Details", new { id = item.id })
     73
    7474
    7575                </td>
    7676            }
    77            
    7877
    7978
    80            
    81        
    82            
    83     </tr>
    84 }
     79
     80
     81
     82
     83        </tr>
     84    }
    8585
    8686</table>
Note: See TracChangeset for help on using the changeset viewer.