Compare commits
2 Commits
6012168a59
...
1547eaee8d
Author | SHA1 | Date | |
---|---|---|---|
|
1547eaee8d | ||
|
74e3d94f9a |
@ -8,8 +8,33 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Demo.Data.Repository
|
namespace Demo.Data.Repository
|
||||||
{
|
{
|
||||||
public class GroupRepositoryImpl
|
public class GroupRepositoryImpl:IGroupRepository
|
||||||
{
|
{
|
||||||
|
public bool AddGroup(GroupLocalEntity newGroup)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GroupLocalEntity> GetAllGroup()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public List<GroupLocalEntity> GetAllGroups() => LocalStaticData.groups;
|
public List<GroupLocalEntity> GetAllGroups() => LocalStaticData.groups;
|
||||||
|
|
||||||
|
public GroupLocalEntity GetGroupById(int groupID)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool RemoveGroupById(int groupID)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
Demo/Data/Repository/IGroupRepository.cs
Normal file
18
Demo/Data/Repository/IGroupRepository.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using Demo.domain.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Demo.Data.Repository
|
||||||
|
{
|
||||||
|
public interface IGroupRepository
|
||||||
|
{
|
||||||
|
List<GroupLocalEntity> GetAllGroup();
|
||||||
|
bool RemoveGroupById(int groupID);
|
||||||
|
bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup);
|
||||||
|
GroupLocalEntity GetGroupById(int groupID);
|
||||||
|
bool AddGroup(GroupLocalEntity newGroup);
|
||||||
|
}
|
||||||
|
}
|
@ -11,4 +11,8 @@
|
|||||||
<Folder Include="Data\RemoteData\" />
|
<Folder Include="Data\RemoteData\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -10,19 +10,19 @@ namespace Demo.Domain.UseCase
|
|||||||
{
|
{
|
||||||
public class UserUseCase
|
public class UserUseCase
|
||||||
{
|
{
|
||||||
private UserRepositoryImpl _repositoryUserImpl;
|
private readonly UserRepositoryImpl _repositoryUserImpl;
|
||||||
private GroupRepositoryImpl _repositoryGroupImpl;
|
private readonly IGroupRepository _repositoryGroupImpl;
|
||||||
|
|
||||||
public UserUseCase(UserRepositoryImpl repositoryImpl, GroupRepositoryImpl repositoryGroupImpl)
|
public UserUseCase(UserRepositoryImpl repositoryImpl, IGroupRepository repositoryGroupImpl)
|
||||||
{
|
{
|
||||||
_repositoryUserImpl = repositoryImpl;
|
_repositoryUserImpl = repositoryImpl;
|
||||||
_repositoryGroupImpl = repositoryGroupImpl;
|
_repositoryGroupImpl = repositoryGroupImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroups()
|
private List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroup()
|
||||||
.Select(it => new Group { Id = it.Id, Name = it.Name}).ToList();
|
.Select(it => new Group { Id = it.Id, Name = it.Name}).ToList();
|
||||||
public List<User> GetAllUsers() => _repositoryUserImpl.GetAllUsers
|
public List<User> GetAllUsers() => _repositoryUserImpl.GetAllUsers
|
||||||
.Join(_repositoryGroupImpl.GetAllGroups(),
|
.Join(_repositoryGroupImpl.GetAllGroup(),
|
||||||
user => user.GroupID,
|
user => user.GroupID,
|
||||||
group => group.Id,
|
group => group.Id,
|
||||||
(user, group) =>
|
(user, group) =>
|
||||||
|
@ -3,6 +3,8 @@ using Demo.Data.Repository;
|
|||||||
using Demo.Domain.UseCase;
|
using Demo.Domain.UseCase;
|
||||||
using Demo.UI;
|
using Demo.UI;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GroupRepositoryImpl groupRepositoryImpl = new GroupRepositoryImpl();
|
GroupRepositoryImpl groupRepositoryImpl = new GroupRepositoryImpl();
|
||||||
UserRepositoryImpl userRepositoryImpl = new UserRepositoryImpl();
|
UserRepositoryImpl userRepositoryImpl = new UserRepositoryImpl();
|
||||||
UserUseCase userUseCase = new UserUseCase(userRepositoryImpl, groupRepositoryImpl);
|
UserUseCase userUseCase = new UserUseCase(userRepositoryImpl, groupRepositoryImpl);
|
||||||
|
Loading…
Reference in New Issue
Block a user