some fixes

This commit is contained in:
Schedel Pascal
2024-07-09 10:23:05 +02:00
parent 9e77090bd4
commit bd0053cc03
4 changed files with 12 additions and 4 deletions

View File

@@ -8,4 +8,5 @@ public interface ICharacterManager
bool DeleteCharacter(Character? character);
IQueryable<Character>? GetCharacters(Group? group);
IQueryable<Character>? GetCharacters(UserProfile? profile);
UserProfile? GetOwner(Character? character);
}

View File

@@ -8,7 +8,7 @@ public class DataManagerAction(string id)
{
get
{
if (BaseAction != null)
if (BaseAction is not null)
return $"{BaseAction.ActionId}.{id}";
return id;
}
@@ -27,10 +27,10 @@ public class DataManagerAction(string id)
if (a.ActionId == b.ActionId)
return true;
if (a.BaseAction != null && a.BaseAction.ActionId == b.ActionId)
if (a.BaseAction is not null && a.BaseAction.ActionId == b.ActionId)
return true;
if (b.BaseAction != null && a.ActionId == b.BaseAction.ActionId)
if (b.BaseAction is not null && a.ActionId == b.BaseAction.ActionId)
return true;
return false;

View File

@@ -159,7 +159,7 @@ public class JsonFileDataProvider : IDataProvider
return false;
}
public IQueryable<T>? GetAll<T>(OwnCharObject? context) where T : OwnCharObject
public IQueryable<T>? GetAll<T>() where T : OwnCharObject
{
var t = typeof(T);

View File

@@ -44,4 +44,11 @@ public class CharacterManager(OwnCharManager manager) : OwnCharManagerModule(man
Manager.CheckLogin();
return Manager.DataManager.ExecuteAction(DataManagerActions.Delete, DataManagerActionType.Default, Manager.CurrentUser, character).HasSuccess;
}
public UserProfile? GetOwner(Character? character)
{
ArgumentNullException.ThrowIfNull(character, nameof(character));
Manager.CheckLogin();
return Manager.DataManager.ExecuteAction(DataManagerActions.Association.Owner, DataManagerActionType.Get, Manager.CurrentUser, character).Result as UserProfile;
}
}