mirror of
https://github.com/hargata/lubelog.git
synced 2025-12-10 00:46:08 -06:00
34 lines
1.0 KiB
C#
34 lines
1.0 KiB
C#
using CarCareTracker.External.Interfaces;
|
|
using CarCareTracker.Models;
|
|
using LiteDB;
|
|
|
|
namespace CarCareTracker.External.Implementations
|
|
{
|
|
public class UserConfigDataAccess : IUserConfigDataAccess
|
|
{
|
|
private LiteDatabase db { get; set; }
|
|
private static string tableName = "userconfigrecords";
|
|
public UserConfigDataAccess(ILiteDBInjection liteDB)
|
|
{
|
|
db = liteDB.GetLiteDB();
|
|
}
|
|
public UserConfigData GetUserConfig(int userId)
|
|
{
|
|
var table = db.GetCollection<UserConfigData>(tableName);
|
|
return table.FindById(userId);
|
|
}
|
|
public bool SaveUserConfig(UserConfigData userConfigData)
|
|
{
|
|
var table = db.GetCollection<UserConfigData>(tableName);
|
|
table.Upsert(userConfigData);
|
|
return true;
|
|
}
|
|
public bool DeleteUserConfig(int userId)
|
|
{
|
|
var table = db.GetCollection<UserConfigData>(tableName);
|
|
table.Delete(userId);
|
|
return true;
|
|
}
|
|
}
|
|
}
|