OnPostAsync()
- {
- if (!ModelState.IsValid)
- {
- return Page();
- }
- _context.Attach(ClubBoard).State = EntityState.Modified;
+ ClubBoard = clubboard;
+ ViewData["ClubId"] = new SelectList(_clubServices.Get(), "Id", "Name");
- try
- {
- await _context.SaveChangesAsync();
- }
- catch (DbUpdateConcurrencyException)
- {
- if (!ClubBoardExists(ClubBoard.Id))
- {
- return NotFound();
- }
- else
- {
- throw;
- }
- }
- return RedirectToPage("./Index");
+ var data = _memberRoleService.GetPaginationAllMemberOfBoard(PageIndex1 - 1, PageSize1, ClubBoard.Id);
+ TotalPages1 = data.TotalPagesCount;
+ NotAddStudent = data.Items.ToList();
+ return Page();
}
- private bool ClubBoardExists(int id)
+ public IActionResult OnPost()
{
- return (_context.ClubBoards?.Any(e => e.Id == id)).GetValueOrDefault();
+ _clubBoardService.Update(ClubBoard);
+ return RedirectToPage("./Index", new { clubId = ClubBoard.ClubId });
}
}
-}
+}
\ No newline at end of file
diff --git a/Clup-MemberShip/ClubMemberShip.Present/Pages/PageUser/ClubBoardManage/Index.cshtml b/Clup-MemberShip/ClubMemberShip.Present/Pages/PageUser/ClubBoardManage/Index.cshtml
index 63e978b..15a4fe4 100644
--- a/Clup-MemberShip/ClubMemberShip.Present/Pages/PageUser/ClubBoardManage/Index.cshtml
+++ b/Clup-MemberShip/ClubMemberShip.Present/Pages/PageUser/ClubBoardManage/Index.cshtml
@@ -52,7 +52,6 @@
Edit |
- Details |
@{
if (item.Name != "Owner")
diff --git a/Clup-MemberShip/ClubMemberShip.Service/IMemberRoleService.cs b/Clup-MemberShip/ClubMemberShip.Service/IMemberRoleService.cs
index b64efb3..72a22f1 100644
--- a/Clup-MemberShip/ClubMemberShip.Service/IMemberRoleService.cs
+++ b/Clup-MemberShip/ClubMemberShip.Service/IMemberRoleService.cs
@@ -1,4 +1,5 @@
using ClubMemberShip.Repo.Models;
+using ClubMemberShip.Repo.Utils;
namespace ClubMemberShip.Service;
@@ -6,4 +7,5 @@ public interface IMemberRoleService : IGenericService
{
public void AddMultipleMember(int clubId, int clubBoardId, List studentId);
public List GetAllMemberOfBoard(int boardId);
+ public Pagination GetPaginationAllMemberOfBoard(int pageIndex, int pageSize, int boardId);
}
\ No newline at end of file
diff --git a/Clup-MemberShip/ClubMemberShip.Service/Service/MemberRoleService.cs b/Clup-MemberShip/ClubMemberShip.Service/Service/MemberRoleService.cs
index 8c809fb..9d25b16 100644
--- a/Clup-MemberShip/ClubMemberShip.Service/Service/MemberRoleService.cs
+++ b/Clup-MemberShip/ClubMemberShip.Service/Service/MemberRoleService.cs
@@ -78,7 +78,13 @@ public List GetAllMemberOfBoard(int clubId)
var membership =
UnitOfWork.MemberShipRepo.Get(filter: o => listId.Contains(o.Id));
- var listStudentId = membership.Select(o => o.Id);
- return UnitOfWork.StudentRepo.Get(filter: o => listStudentId.Contains(o.Id));
+ var listStudentId = membership.Select(o => o.StudentId);
+ return UnitOfWork.StudentRepo.Get(filter: o => listStudentId.Contains(o.Id), includeProperties: "Grade,Major");
+ }
+
+ public Pagination GetPaginationAllMemberOfBoard(int pageIndex, int pageSize, int boardId)
+ {
+ var listEntities = GetAllMemberOfBoard(boardId);
+ return UnitOfWork.StudentRepo.ToPagination(listEntities, pageIndex, pageSize);
}
}
\ No newline at end of file
|