phase 1
This commit is contained in:
44
ModVersionChecker/repository/litedb/SourcesLiteDb.cs
Normal file
44
ModVersionChecker/repository/litedb/SourcesLiteDb.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user