This repository has been archived by the owner on Mar 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
124 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using ClubMemberShip.Repo.Models; | ||
|
||
namespace ClubMemberShip.Service; | ||
|
||
public interface IMemberRoleService : IGenericService<MemberRole> | ||
{ | ||
public void AddMultipleMember(int clubId, int clubBoardId, List<int> studentId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
Clup-MemberShip/ClubMemberShip.Service/Service/MemberRoleService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using ClubMemberShip.Repo; | ||
using ClubMemberShip.Repo.Models; | ||
using ClubMemberShip.Repo.Utils; | ||
|
||
namespace ClubMemberShip.Service.Service; | ||
|
||
public class MemberRoleService : GenericService<MemberRole>, IMemberRoleService | ||
{ | ||
public MemberRoleService(IUnitOfWork unitOfWork) : base(unitOfWork) | ||
{ | ||
} | ||
|
||
public override List<MemberRole>? Get() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Pagination<MemberRole> GetPagination(int pageIndex, int pageSize) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override MemberRole? GetById(object? id) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Result Update(MemberRole newEntity) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Result Delete(object idToDelete) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Result Add(MemberRole newEntity) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void AddMultipleMember(int clubId, int clubBoardId, List<int> studentId) | ||
{ | ||
var membership = | ||
UnitOfWork.MemberShipRepo.Get(filter: o => o.ClubId == clubId && studentId.Contains(o.StudentId)); | ||
|
||
foreach (var o in membership) | ||
{ | ||
var existed = UnitOfWork.MemberRoleRepo.GetIgnoreDeleted(filter: p => | ||
p.MembershipId == o.Id && p.ClubBoardId == clubBoardId); | ||
|
||
if (existed.Count > 0) | ||
{ | ||
existed[0].Status = Status.Active; | ||
} | ||
else | ||
{ | ||
UnitOfWork.MemberRoleRepo.Create(new MemberRole | ||
{ | ||
MembershipId = o.Id, | ||
ClubBoardId = clubBoardId, | ||
StartDay = DateTime.Today, | ||
EndDay = default, | ||
Role = null, | ||
}); | ||
} | ||
} | ||
|
||
UnitOfWork.SaveChange(); | ||
} | ||
} |