45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
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();
|
|
}
|
|
}
|
|
}
|