Compare commits

..

No commits in common. "1547eaee8d938fc2894436458dcb653a79f8c499" and "6012168a59e9bbf0281cdaaa8d7f6e69b8ecec8f" have entirely different histories.

5 changed files with 7 additions and 56 deletions

View File

@ -8,33 +8,8 @@ using System.Threading.Tasks;
namespace Demo.Data.Repository namespace Demo.Data.Repository
{ {
public class GroupRepositoryImpl:IGroupRepository public class GroupRepositoryImpl
{ {
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();
}
} }
} }

View File

@ -1,18 +0,0 @@
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);
}
}

View File

@ -11,8 +11,4 @@
<Folder Include="Data\RemoteData\" /> <Folder Include="Data\RemoteData\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
</ItemGroup>
</Project> </Project>

View File

@ -10,19 +10,19 @@ namespace Demo.Domain.UseCase
{ {
public class UserUseCase public class UserUseCase
{ {
private readonly UserRepositoryImpl _repositoryUserImpl; private UserRepositoryImpl _repositoryUserImpl;
private readonly IGroupRepository _repositoryGroupImpl; private GroupRepositoryImpl _repositoryGroupImpl;
public UserUseCase(UserRepositoryImpl repositoryImpl, IGroupRepository repositoryGroupImpl) public UserUseCase(UserRepositoryImpl repositoryImpl, GroupRepositoryImpl repositoryGroupImpl)
{ {
_repositoryUserImpl = repositoryImpl; _repositoryUserImpl = repositoryImpl;
_repositoryGroupImpl = repositoryGroupImpl; _repositoryGroupImpl = repositoryGroupImpl;
} }
private List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroup() public List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroups()
.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.GetAllGroup(), .Join(_repositoryGroupImpl.GetAllGroups(),
user => user.GroupID, user => user.GroupID,
group => group.Id, group => group.Id,
(user, group) => (user, group) =>

View File

@ -3,8 +3,6 @@ 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);