Files
First_Exercise/test/Views/Users/Dashboard.cshtml
2025-07-24 10:39:39 +03:30

98 lines
2.5 KiB
Plaintext

@using test.Models
@{
ViewBag.Title = "پنل کاربری";
var name = Session["UserName"];
var Categories = ViewBag.Categories as List<Category>;
var tag = ViewBag.tag as List<Tag>;
}
<h2>به پنل خوش آمدید</h2>
<p>سلام @name عزیز 🎉</p>
<a href="@Url.Action("Logout", "Users")" class="btn btn-danger">خروج</a>
@{
ViewBag.Title = "داشبورد";
}
<h2>به پنل خوش آمدید، @Session["UserName"]</h2>
<hr />
@if (TempData["CategoryMessage"] != null)
{
<p class="alert alert-success">@TempData["CategoryMessage"]</p>
}
@if (TempData["TagMessage"] != null)
{
<p class="alert alert-success">@TempData["TagMessage"]</p>
}
<div class="row">
<div class="col-md-6">
<h4>افزودن دسته‌بندی جدید</h4>
@using (Html.BeginForm("AddCategoryFromDashboard", "Users", FormMethod.Post))
{
@Html.AntiForgeryToken()
<div class="form-group">
<label>عنوان دسته‌بندی</label>
<input type="text" name="Catgegory_Title" class="form-control" required />
</div>
<button type="submit" class="btn btn-success">افزودن دسته‌بندی</button>
}
</div>
<div class="col-md-6">
<h4>افزودن تگ جدید</h4>
@using (Html.BeginForm("AddTagFromDashboard", "Users", FormMethod.Post))
{
@Html.AntiForgeryToken()
<div class="form-group">
<label>عنوان تگ</label>
<input type="text" name="Tag_Title" class="form-control" required />
</div>
<button type="submit" class="btn btn-success">افزودن تگ</button>
}
</div>
</div>
<h4 class="mt-5">لیست دسته‌بندی‌ها</h4>
<table class="table table-bordered">
<thead>
<tr>
<th>شناسه</th>
<th>عنوان</th>
</tr>
</thead>
<tbody>
@foreach (var cat in Categories)
{
<tr>
<td>@cat.Category_ID</td>
<td>@cat.Catgegory_Title</td>
</tr>
}
</tbody>
</table>
<h4 class="mt-4">لیست تگ‌ها</h4>
<table class="table table-bordered">
<thead>
<tr>
<th>شناسه</th>
<th>عنوان</th>
</tr>
</thead>
<tbody>
@foreach (var tagg in tag)
{
<tr>
<td>@tagg.Tag_ID</td>
<td>@tagg.Tag_Title</td>
</tr>
}
</tbody>
</table>