Removed duplicated code

pull/12798/head
JPVenson 5 months ago
parent 8165813414
commit 3b8e177ba8

@ -70,6 +70,10 @@ public class PeopleRepository(IDbContextFactory<JellyfinDbContext> dbProvider, I
context.Peoples.Add(personEntity);
existingEntity = personEntity;
}
else
{
context.Peoples.Attach(personEntity).State = EntityState.Modified;
}
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();
transaction.Commit();
}

Loading…
Cancel
Save