1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
@model IEnumerable<Project_Unite.Models.ForumCategory>
@{
ViewBag.Title = "Manage forums";
ViewBag.Modals = new Dictionary<string, string>();
}
<h2>Forums</h2>
<p>The forums are a way for users to start conversations about various topics. Here you can define where users can post and what roles can post where.</p>
@foreach (var cat in Model)
{
<table class="table">
<tr>
<th>@cat.Name [@Html.ActionLink("Edit", "EditForum", "Admin", new { id = cat.Id }, null) | <a href="#[email protected]" data-toggle="modal" data-target="#[email protected]">Delete</a>]
<!-- Modal -->
</th>
<th>Topics</th>
<th>Posts</th>
<th>Actions</th>
</tr>
@foreach (var subcat in cat.Children)
{
<tr>
<td>
@Html.ActionLink(subcat.Name, "ViewForum", "Forum", new { id = subcat.Id }) <br />
<p>@subcat.Description</p>
</td>
<td>@subcat.Topics?.Count</td>
<td></td>
<td>
@Html.ActionLink("Edit", "EditForum", "Admin", new { id = subcat.Id }, new { @class = "btn btn-default" })
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#[email protected]">Delete</button>
</td>
</tr>
ViewBag.Modals.Add(subcat.Id, "/Admin/DeleteForum?id=" + subcat.Id);
}
</table>
ViewBag.Modals.Add(cat.Id, "/Admin/DeleteForum?id=" + cat.Id);
}
@Html.ActionLink("Add category", "AddForumCategory", "Admin", null, new { @class = "btn btn-default"})
|