mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Removed duplicated code
This commit is contained in:
parent
8165813414
commit
3b8e177ba8
@ -70,6 +70,10 @@ public class PeopleRepository(IDbContextFactory<JellyfinDbContext> dbProvider, I
|
|||||||
context.Peoples.Add(personEntity);
|
context.Peoples.Add(personEntity);
|
||||||
existingEntity = personEntity;
|
existingEntity = personEntity;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
context.Peoples.Attach(personEntity).State = EntityState.Modified;
|
||||||
|
}
|
||||||
|
|
||||||
context.PeopleBaseItemMap.Add(new PeopleBaseItemMap()
|
context.PeopleBaseItemMap.Add(new PeopleBaseItemMap()
|
||||||
{
|
{
|
||||||
@ -83,18 +87,6 @@ public class PeopleRepository(IDbContextFactory<JellyfinDbContext> dbProvider, I
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var person in people.Select(Map))
|
|
||||||
{
|
|
||||||
if (context.Peoples.Any(f => f.Id == person.Id))
|
|
||||||
{
|
|
||||||
context.Peoples.Attach(person).State = EntityState.Modified;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
context.Peoples.Add(person);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user