diff --git a/Kyoo.CommonAPI/LocalRepository.cs b/Kyoo.CommonAPI/LocalRepository.cs index b106bf96..f7876131 100644 --- a/Kyoo.CommonAPI/LocalRepository.cs +++ b/Kyoo.CommonAPI/LocalRepository.cs @@ -277,22 +277,28 @@ namespace Kyoo.Controllers Task IRepository.Create(T item) { - TInternal obj = new TInternal(); - Utility.Assign(obj, item); + TInternal obj = item as TInternal ?? new TInternal(); + if (!(item is TInternal)) + Utility.Assign(obj, item); + return Create(obj).Cast() .Then(x => item.ID = x.ID); } Task IRepository.CreateIfNotExists(T item) { - TInternal obj = new TInternal(); - Utility.Assign(obj, item); + TInternal obj = item as TInternal ?? new TInternal(); + if (!(item is TInternal)) + Utility.Assign(obj, item); + return CreateIfNotExists(obj).Cast() .Then(x => item.ID = x.ID); } public Task Edit(T edited, bool resetOld) { + if (edited is TInternal intern) + return Edit(intern, resetOld).Cast(); TInternal obj = new TInternal(); Utility.Assign(obj, edited); return base.Edit(obj, resetOld).Cast(); @@ -302,6 +308,8 @@ namespace Kyoo.Controllers Task IRepository.Delete(T obj) { + if (obj is TInternal intern) + return Delete(intern); TInternal item = new TInternal(); Utility.Assign(item, obj); return Delete(item); diff --git a/Kyoo/Views/WebClient b/Kyoo/Views/WebClient index 735a0e6a..0f3faa21 160000 --- a/Kyoo/Views/WebClient +++ b/Kyoo/Views/WebClient @@ -1 +1 @@ -Subproject commit 735a0e6a1a7ae2653de45b47adc823275a46478d +Subproject commit 0f3faa21fad37b2ed39317d58aa3e295fa1c3a41