diff --git a/EnotaryoPH/EnotaryoPH.Data/NotaryoDBContext.cs b/EnotaryoPH/EnotaryoPH.Data/NotaryoDBContext.cs index 0ad5e93..e300789 100644 --- a/EnotaryoPH/EnotaryoPH.Data/NotaryoDBContext.cs +++ b/EnotaryoPH/EnotaryoPH.Data/NotaryoDBContext.cs @@ -38,5 +38,18 @@ namespace EnotaryoPH.Data public DbSet TransactionSignatoryDeclineReasons { get; set; } public DbSet Users { get; set; } public DbSet VideoRecordings { get; set; } + + public TEntity UpdateOrCreate(TEntity entity) where TEntity : class + { + if (Entry(entity).State == EntityState.Detached) + { + Set().Add(entity); + } + else + { + Set().Update(entity); + } + return entity; + } } } \ No newline at end of file