This commit is contained in:
Jose Conde
2025-09-29 16:02:00 +02:00
parent dc57da8136
commit 5e16f781b4
74 changed files with 1621 additions and 1856 deletions

View File

@@ -0,0 +1,44 @@
using ModVersionChecker.managers.interfaces;
using ModVersionChecker.repository.api.dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ModVersionChecker.managers.litedb
{
public class SourcesLiteDb : LiteDb, ISourcesDefManager
{
protected override string collection => SOURCES_DEF_COLLECTION;
public List<SourceResponse> List()
{
return GetCollection<SourceResponse>().FindAll().ToList();
}
public SourceResponse? GetById(string id)
{
return GetCollection<SourceResponse>().FindOne(x => x.Id == id);
}
public void AddSourceDef(SourceResponse sourceDef)
{
GetCollection<SourceResponse>().Insert(sourceDef);
}
public void RemoveSourceDef(string id)
{
GetCollection<SourceResponse>().Delete(id);
}
public void Save(SourceResponse sourceDef)
{
GetCollection<SourceResponse>().Upsert(sourceDef);
}
public void DeleteAll()
{
GetCollection<SourceResponse>().DeleteAll();
}
}
}