mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Fixing a bug with the registration of shows
This commit is contained in:
parent
6575cb5ea6
commit
522d253e9c
@ -71,7 +71,7 @@ namespace Kyoo
|
||||
if (isEqual == null)
|
||||
return first.Concat(second).ToList();
|
||||
List<T> list = first.ToList();
|
||||
return list.Concat(second.Where(x => !list.Any(y => isEqual(x, y)))).ToList();
|
||||
return list.Concat(second.Where(x => !list.Any(y => isEqual(x, y))));
|
||||
}
|
||||
|
||||
public static T Assign<T>(T first, T second)
|
||||
|
@ -84,9 +84,17 @@ namespace Kyoo.Controllers
|
||||
{
|
||||
await base.Create(obj);
|
||||
_database.Entry(obj).State = EntityState.Added;
|
||||
|
||||
if (obj.GenreLinks != null)
|
||||
{
|
||||
foreach (GenreLink entry in obj.GenreLinks)
|
||||
{
|
||||
if (!(entry.Genre is GenreDE))
|
||||
entry.Genre = new GenreDE(entry.Genre);
|
||||
_database.Entry(entry).State = EntityState.Added;
|
||||
}
|
||||
}
|
||||
|
||||
if (obj.People != null)
|
||||
foreach (PeopleRole entry in obj.People)
|
||||
_database.Entry(entry).State = EntityState.Added;
|
||||
|
@ -7,21 +7,21 @@ namespace Kyoo.Models
|
||||
{
|
||||
public class CollectionDE : Collection
|
||||
{
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<CollectionLink> Links { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual ICollection<CollectionLink> Links { get; set; }
|
||||
[ExpressionRewrite(nameof(Links), nameof(CollectionLink.Show))]
|
||||
public override IEnumerable<Show> Shows
|
||||
{
|
||||
get => Links?.Select(x => x.Show);
|
||||
set => Links = value?.Select(x => new CollectionLink(this, x));
|
||||
set => Links = value?.Select(x => new CollectionLink(this, x)).ToList();
|
||||
}
|
||||
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<LibraryLink> LibraryLinks { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual ICollection<LibraryLink> LibraryLinks { get; set; }
|
||||
|
||||
[ExpressionRewrite(nameof(LibraryLinks), nameof(GenreLink.Genre))]
|
||||
public override IEnumerable<Library> Libraries
|
||||
{
|
||||
get => LibraryLinks?.Select(x => x.Library);
|
||||
set => LibraryLinks = value?.Select(x => new LibraryLink(x, this));
|
||||
set => LibraryLinks = value?.Select(x => new LibraryLink(x, this)).ToList();
|
||||
}
|
||||
|
||||
public CollectionDE() {}
|
||||
|
@ -7,13 +7,13 @@ namespace Kyoo.Models
|
||||
{
|
||||
public class GenreDE : Genre
|
||||
{
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<GenreLink> Links { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual ICollection<GenreLink> Links { get; set; }
|
||||
|
||||
[ExpressionRewrite(nameof(Links), nameof(GenreLink.Genre))]
|
||||
[JsonIgnore] [NotMergable] public override IEnumerable<Show> Shows
|
||||
{
|
||||
get => Links?.Select(x => x.Show);
|
||||
set => Links = value?.Select(x => new GenreLink(x, this));
|
||||
set => Links = value?.Select(x => new GenreLink(x, this)).ToList();
|
||||
}
|
||||
|
||||
public GenreDE() {}
|
||||
|
@ -7,7 +7,7 @@ namespace Kyoo.Models
|
||||
{
|
||||
public class LibraryDE : Library
|
||||
{
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<ProviderLink> ProviderLinks { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual ICollection<ProviderLink> ProviderLinks { get; set; }
|
||||
[ExpressionRewrite(nameof(ProviderLinks), nameof(ProviderLink.Provider))]
|
||||
public override IEnumerable<ProviderID> Providers
|
||||
{
|
||||
@ -15,14 +15,14 @@ namespace Kyoo.Models
|
||||
set => ProviderLinks = value?.Select(x => new ProviderLink(x, this)).ToList();
|
||||
}
|
||||
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<LibraryLink> Links { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual ICollection<LibraryLink> Links { get; set; }
|
||||
[ExpressionRewrite(nameof(Links), nameof(LibraryLink.Show))]
|
||||
public override IEnumerable<Show> Shows
|
||||
{
|
||||
get => Links?.Where(x => x.Show != null).Select(x => x.Show);
|
||||
set => Links = Utility.MergeLists(
|
||||
value?.Select(x => new LibraryLink(this, x)),
|
||||
Links?.Where(x => x.Show == null));
|
||||
Links?.Where(x => x.Show == null))?.ToList();
|
||||
}
|
||||
[ExpressionRewrite(nameof(Links), nameof(LibraryLink.Collection))]
|
||||
public override IEnumerable<Collection> Collections
|
||||
@ -30,7 +30,7 @@ namespace Kyoo.Models
|
||||
get => Links?.Where(x => x.Collection != null).Select(x => x.Collection);
|
||||
set => Links = Utility.MergeLists(
|
||||
value?.Select(x => new LibraryLink(this, x)),
|
||||
Links?.Where(x => x.Collection == null));
|
||||
Links?.Where(x => x.Collection == null))?.ToList();
|
||||
}
|
||||
|
||||
public LibraryDE() {}
|
||||
|
@ -10,28 +10,28 @@ namespace Kyoo.Models
|
||||
{
|
||||
public class ShowDE : Show
|
||||
{
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<GenreLink> GenreLinks { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual ICollection<GenreLink> GenreLinks { get; set; }
|
||||
[ExpressionRewrite(nameof(GenreLinks), nameof(GenreLink.Genre))]
|
||||
public override IEnumerable<Genre> Genres
|
||||
{
|
||||
get => GenreLinks?.Select(x => x.Genre);
|
||||
set => GenreLinks = value?.Select(x => new GenreLink(this, x));
|
||||
set => GenreLinks = value?.Select(x => new GenreLink(this, x)).ToList();
|
||||
}
|
||||
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<LibraryLink> LibraryLinks { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual ICollection<LibraryLink> LibraryLinks { get; set; }
|
||||
[ExpressionRewrite(nameof(LibraryLinks), nameof(LibraryLink.Library))]
|
||||
public override IEnumerable<Library> Libraries
|
||||
{
|
||||
get => LibraryLinks?.Select(x => x.Library);
|
||||
set => LibraryLinks = value?.Select(x => new LibraryLink(x, this));
|
||||
set => LibraryLinks = value?.Select(x => new LibraryLink(x, this)).ToList();
|
||||
}
|
||||
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<CollectionLink> CollectionLinks { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual ICollection<CollectionLink> CollectionLinks { get; set; }
|
||||
[ExpressionRewrite(nameof(CollectionLinks), nameof(CollectionLink.Collection))]
|
||||
public override IEnumerable<Collection> Collections
|
||||
{
|
||||
get => CollectionLinks?.Select(x => x.Collection);
|
||||
set => CollectionLinks = value?.Select(x => new CollectionLink(x, this));
|
||||
set => CollectionLinks = value?.Select(x => new CollectionLink(x, this)).ToList();
|
||||
}
|
||||
|
||||
public ShowDE() {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user