mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-23 17:52:36 -04:00
Fix seasons add
This commit is contained in:
parent
9b606cf9ac
commit
ae6121f3aa
1
back/.gitignore
vendored
1
back/.gitignore
vendored
@ -2,6 +2,7 @@ out
|
||||
libtranscoder.so
|
||||
libtranscoder.dylib
|
||||
transcoder.dll
|
||||
kyoo_datadir
|
||||
|
||||
video
|
||||
.env
|
||||
|
@ -152,7 +152,7 @@ namespace Kyoo.Core.Controllers
|
||||
/// <inheritdoc />
|
||||
public override async Task<Episode> Create(Episode obj)
|
||||
{
|
||||
obj.ShowSlug = obj.Show?.Slug ?? _database.Shows.First(x => x.Id == obj.ShowId).Slug;
|
||||
obj.ShowSlug = obj.Show?.Slug ?? (await _database.Shows.FirstAsync(x => x.Id == obj.ShowId)).Slug;
|
||||
await base.Create(obj);
|
||||
_database.Entry(obj).State = EntityState.Added;
|
||||
await _database.SaveChangesAsync(() =>
|
||||
@ -176,6 +176,11 @@ namespace Kyoo.Core.Controllers
|
||||
}
|
||||
resource.ShowId = resource.Show.Id;
|
||||
}
|
||||
if (resource.SeasonId == null && resource.SeasonNumber != null)
|
||||
{
|
||||
resource.Season = await _database.Seasons.FirstOrDefaultAsync(x => x.ShowId == resource.ShowId
|
||||
&& x.SeasonNumber == resource.SeasonNumber);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
Loading…
x
Reference in New Issue
Block a user