using ModVersionChecker.data.model; using ModVersionChecker.managers.interfaces; 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 { private string collection = SOURCES_DEF_COLLECTION; public List List() { var col = _db.GetCollection(collection); return col.FindAll().ToList(); } public SourceDef? GetById(string id) { var col = _db.GetCollection(collection); return col.FindOne(x => x.Id == id); } public void AddSourceDef(SourceDef sourceDef) { var col = _db.GetCollection(collection); col.Insert(sourceDef); } public void RemoveSourceDef(string id) { var col = _db.GetCollection(collection); col.Delete(id); } public void Save(SourceDef sourceDef) { var col = _db.GetCollection(collection); col.Upsert(sourceDef); } } }