finish get-character implementation
This commit is contained in:
@@ -16,4 +16,8 @@ public interface IDataManager
|
|||||||
// Group management
|
// Group management
|
||||||
abstract UserProfile? GetOwner(Group group);
|
abstract UserProfile? GetOwner(Group group);
|
||||||
abstract IEnumerable<UserProfile>? GetMembers(Group group);
|
abstract IEnumerable<UserProfile>? GetMembers(Group group);
|
||||||
|
|
||||||
|
// Character management
|
||||||
|
abstract IEnumerable<Character>? GetCharacters(Group group);
|
||||||
|
abstract IEnumerable<Character>? GetCharacters(UserProfile profile);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,4 +26,6 @@ public interface IDataProvider
|
|||||||
abstract IEnumerable<UserProfile>? GetGroupMembers(Group group);
|
abstract IEnumerable<UserProfile>? GetGroupMembers(Group group);
|
||||||
abstract UserProfile? GetOwner(Group group);
|
abstract UserProfile? GetOwner(Group group);
|
||||||
abstract UserProfile? GetOwner(Character character);
|
abstract UserProfile? GetOwner(Character character);
|
||||||
|
abstract IEnumerable<Character>? GetCharacters(Group group);
|
||||||
|
abstract IEnumerable<Character>? GetCharacters(UserProfile jprofile);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,4 +87,14 @@ public class DefaultDataManager : IDataManager
|
|||||||
DataProvider.Delete(account);
|
DataProvider.Delete(account);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Character>? GetCharacters(Group group)
|
||||||
|
{
|
||||||
|
return DataProvider.GetCharacters(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Character>? GetCharacters(UserProfile profile)
|
||||||
|
{
|
||||||
|
return DataProvider.GetCharacters(profile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,4 +221,18 @@ public class JsonFileDataProvider : IDataProvider
|
|||||||
return jcharacter.Owner;
|
return jcharacter.Owner;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Character>? GetCharacters(Group group)
|
||||||
|
{
|
||||||
|
if (group is JsonGroup jgroup)
|
||||||
|
return jgroup.Characters;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Character>? GetCharacters(UserProfile profile)
|
||||||
|
{
|
||||||
|
if (profile is UserProfile jprofile)
|
||||||
|
return JsonFile.Characters.Where(n => n.Owner == profile);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,21 @@ public class CharacterManager(OwnCharManager manager)
|
|||||||
|
|
||||||
public IEnumerable<Character>? GetCharacters(Group? group)
|
public IEnumerable<Character>? GetCharacters(Group? group)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
Manager.CheckLogin();
|
||||||
|
|
||||||
|
if (group != null)
|
||||||
|
return Manager.DataManager?.GetCharacters(group);
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Character>? GetCharacters(UserProfile? profile)
|
public IEnumerable<Character>? GetCharacters(UserProfile? profile)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
Manager.CheckLogin();
|
||||||
|
|
||||||
|
if (profile != null)
|
||||||
|
return Manager.DataManager?.GetCharacters(profile);
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user