diff --git a/Controllers/AdminController.cs b/Controllers/AdminController.cs index 7a9d54a..4681a22 100644 --- a/Controllers/AdminController.cs +++ b/Controllers/AdminController.cs @@ -19,6 +19,30 @@ public ActionResult Index() return View(); } + public ActionResult ViewPermissions(int? id) + { + int perpage = 5; + int currentpage = id ?? 1; + var _permissions = this.db.Permissions.ToList(); + + var permissions = _permissions.Skip((currentpage - 1) * perpage).Take(perpage).ToList(); + int maxpage = (int)Math.Ceiling(Convert.ToDouble(_permissions.Count()) / Convert.ToDouble(perpage)); + + ViewBag.Permissions = permissions; + + if (currentpage < maxpage) + { + ViewBag.NextPageUrl = Url.Action("ViewPermissions", new { id = currentpage + 1 }); + } + + if (1 < currentpage) + { + ViewBag.PreviousPageUrl = Url.Action("ViewPermissions", new { id = currentpage - 1 }); + } + + return View(); + } + [HttpGet] public ActionResult CreatePermission() { diff --git a/ERPSystemTimologio.csproj b/ERPSystemTimologio.csproj index ddbf22b..923d96d 100644 --- a/ERPSystemTimologio.csproj +++ b/ERPSystemTimologio.csproj @@ -287,6 +287,7 @@ + diff --git a/Views/Admin/ViewPermissions.cshtml b/Views/Admin/ViewPermissions.cshtml new file mode 100644 index 0000000..ccbe3a7 --- /dev/null +++ b/Views/Admin/ViewPermissions.cshtml @@ -0,0 +1,53 @@ + +@{ + ViewBag.Title = "ViewPermission"; +} +
+ + + + + + + + + + @foreach (ERPSystemTimologio.EF.Permission permission in ViewBag.Permissions) + { + + + + + + } + +
NamePermissionsAction
@permission.Name + @(permission.InvoiceAdd == 1 ? "Invoice Add, " : "") + @(permission.InvoiceManage == 1 ? "Invoice Manage, " : "") + @(permission.InventoryManage == 1 ? "Inventory Manage, " : "") + @(permission.CategoryManage == 1 ? "Category Manage, " : "") + @(permission.StationManage == 1 ? "Region/Branch Manage, " : "") + @(permission.OperationManage == 1 ? "Operation Manage, " : "") + @(permission.UserManage == 1 ? "User Manage, " : "") + @(permission.PermissionManage == 1 ? "Permission Manage, " : "") + + Edit + Delete +
+
+
+ +
\ No newline at end of file