|
|
@ -25,27 +25,21 @@ namespace Ombi.Store.Repository
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//_cache.Remove(GetName(entity.SettingsName));
|
|
|
|
//_cache.Remove(GetName(entity.SettingsName));
|
|
|
|
|
|
|
|
|
|
|
|
using (var tran = Db.Database.BeginTransaction())
|
|
|
|
var settings = Db.Settings.Add(entity);
|
|
|
|
{
|
|
|
|
Db.SaveChanges();
|
|
|
|
var settings = Db.Settings.Add(entity);
|
|
|
|
return settings.Entity;
|
|
|
|
Db.SaveChanges();
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
|
|
|
return settings.Entity;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<GlobalSettings> InsertAsync(GlobalSettings entity)
|
|
|
|
public async Task<GlobalSettings> InsertAsync(GlobalSettings entity)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
using (var tran = Db.Database.BeginTransaction())
|
|
|
|
//_cache.Remove(GetName(entity.SettingsName));
|
|
|
|
{
|
|
|
|
var settings = await Db.Settings.AddAsync(entity);
|
|
|
|
//_cache.Remove(GetName(entity.SettingsName));
|
|
|
|
await Db.SaveChangesAsync();
|
|
|
|
var settings = await Db.Settings.AddAsync(entity);
|
|
|
|
|
|
|
|
await Db.SaveChangesAsync();
|
|
|
|
return settings.Entity;
|
|
|
|
tran.Commit();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return settings.Entity;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -87,23 +81,15 @@ namespace Ombi.Store.Repository
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//_cache.Remove(GetName(entity.SettingsName));
|
|
|
|
//_cache.Remove(GetName(entity.SettingsName));
|
|
|
|
|
|
|
|
|
|
|
|
using (var tran = Db.Database.BeginTransaction())
|
|
|
|
Db.Settings.Remove(entity);
|
|
|
|
{
|
|
|
|
Db.SaveChanges();
|
|
|
|
Db.Settings.Remove(entity);
|
|
|
|
|
|
|
|
Db.SaveChanges();
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Update(GlobalSettings entity)
|
|
|
|
public void Update(GlobalSettings entity)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
using (var tran = Db.Database.BeginTransaction())
|
|
|
|
Db.Update(entity);
|
|
|
|
{
|
|
|
|
//_cache.Remove(GetName(entity.SettingsName));
|
|
|
|
Db.Update(entity);
|
|
|
|
Db.SaveChanges();
|
|
|
|
//_cache.Remove(GetName(entity.SettingsName));
|
|
|
|
|
|
|
|
Db.SaveChanges();
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private string GetName(string entity)
|
|
|
|
private string GetName(string entity)
|
|
|
@ -113,13 +99,8 @@ namespace Ombi.Store.Repository
|
|
|
|
|
|
|
|
|
|
|
|
private async Task<int> InternalSaveChanges()
|
|
|
|
private async Task<int> InternalSaveChanges()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
var r = await Db.SaveChangesAsync();
|
|
|
|
using (var tran = Db.Database.BeginTransaction())
|
|
|
|
return r;
|
|
|
|
{
|
|
|
|
|
|
|
|
var r = await Db.SaveChangesAsync();
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|