Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
Lesson49
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Пасько Виталий
Lesson49
Commits
242d1f32
Commit
242d1f32
authored
Jul 04, 2022
by
TTrueBenji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил панель навигации Bootstrap.
parent
6c248099
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
22 deletions
+28
-22
UserService.cs
PhoneStore/Services/UserService.cs
+0
-2
PageViewModel.cs
PhoneStore/ViewModels/PageViewModel.cs
+2
-0
Index.cshtml
PhoneStore/Views/Users/Index.cshtml
+26
-20
No files found.
PhoneStore/Services/UserService.cs
View file @
242d1f32
using
System.Linq
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
PhoneStore.Helpers
;
using
PhoneStore.Helpers
;
using
PhoneStore.Models
;
using
PhoneStore.Models
;
...
...
PhoneStore/ViewModels/PageViewModel.cs
View file @
242d1f32
...
@@ -8,10 +8,12 @@ namespace PhoneStore.ViewModels
...
@@ -8,10 +8,12 @@ namespace PhoneStore.ViewModels
public
int
TotalPages
{
get
;
set
;
}
public
int
TotalPages
{
get
;
set
;
}
public
bool
HasPrevious
=>
Page
>
1
;
public
bool
HasPrevious
=>
Page
>
1
;
public
bool
HasNext
=>
Page
<
TotalPages
;
public
bool
HasNext
=>
Page
<
TotalPages
;
public
int
Count
{
get
;
set
;
}
public
PageViewModel
(
int
page
,
int
count
,
int
pageSize
)
public
PageViewModel
(
int
page
,
int
count
,
int
pageSize
)
{
{
Page
=
page
;
Page
=
page
;
Count
=
count
;
TotalPages
=
(
int
)
Math
.
Ceiling
(
count
/
(
double
)
pageSize
);
TotalPages
=
(
int
)
Math
.
Ceiling
(
count
/
(
double
)
pageSize
);
}
}
}
}
...
...
PhoneStore/Views/Users/Index.cshtml
View file @
242d1f32
...
@@ -55,23 +55,29 @@
...
@@ -55,23 +55,29 @@
</tr>
</tr>
}
}
</table>
</table>
@if (Model.PageViewModel.HasPrevious)
<nav aria-label="Page navigation">
{
<ul class="pagination justify-content-left">
@if (Model.PageViewModel.HasPrevious)
{
<li class="page-item">
<a
<a
asp-action="Index"
asp-action="Index"
asp-controller="Users"
asp-controller="Users"
asp-route-page="@(Model.PageViewModel.Page - 1)" class="btn btn-outline-warning"
class="page-link"
asp-route-filterByName="@Model.Filter">
asp-route-page="@(Model.PageViewModel.Page - 1)"
Назад
asp-route-filterByName="@Model.Filter">Previous</a>
</a>
</li>
}
}
@if (Model.PageViewModel.HasNext)
@if (Model.PageViewModel.HasNext)
{
{
<li class="page-item">
<a
<a
class="page-link"
asp-action="Index"
asp-action="Index"
asp-controller="Users"
asp-controller="Users"
asp-route-page="@(Model.PageViewModel.Page + 1)" class="btn btn-outline-warning"
asp-route-page="@(Model.PageViewModel.Page + 1)"
asp-route-filterByName="@Model.Filter">
asp-route-filterByName="@Model.Filter">Next</a>
Вперед
</li>
</a>
}
}
</ul>
\ No newline at end of file
</nav>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment