finish get-character implementation
This commit is contained in:
@@ -16,4 +16,8 @@ public interface IDataManager
|
||||
// Group management
|
||||
abstract UserProfile? GetOwner(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 UserProfile? GetOwner(Group group);
|
||||
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);
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user