mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
moved everything up a directory
This commit is contained in:
parent
448cd8d92e
commit
9a78f790a6
76 changed files with 0 additions and 0 deletions
42
RequestPlex.Core/SettingsService.cs
Normal file
42
RequestPlex.Core/SettingsService.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Mono.Data.Sqlite;
|
||||
|
||||
using RequestPlex.Store;
|
||||
|
||||
namespace RequestPlex.Core
|
||||
{
|
||||
public class SettingsService
|
||||
{
|
||||
public void SaveSettings(int port)
|
||||
{
|
||||
var db = new DbConfiguration(new SqliteFactory());
|
||||
var repo = new GenericRepository<SettingsModel>(db);
|
||||
|
||||
var existingSettings = repo.GetAll().FirstOrDefault();
|
||||
if (existingSettings != null)
|
||||
{
|
||||
existingSettings.Port = port;
|
||||
repo.Update(existingSettings);
|
||||
return;
|
||||
}
|
||||
|
||||
var newSettings = new SettingsModel { Port = port };
|
||||
repo.Insert(newSettings);
|
||||
}
|
||||
|
||||
public SettingsModel GetSettings()
|
||||
{
|
||||
var db = new DbConfiguration(new SqliteFactory());
|
||||
var repo = new GenericRepository<SettingsModel>(db);
|
||||
|
||||
var settings = repo.GetAll().FirstOrDefault();
|
||||
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue