Add backup management
This commit is contained in:
37
src/Managing.Application/ManageBot/BotService.cs
Normal file
37
src/Managing.Application/ManageBot/BotService.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Managing.Application.Abstractions;
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
|
||||
namespace Managing.Application.ManageBot
|
||||
{
|
||||
public class BotService : IBotService
|
||||
{
|
||||
private readonly IBotFactory _botFactory;
|
||||
private readonly IBotRepository _botRepository;
|
||||
|
||||
public BotService(IBotFactory botFactory, IBotRepository botRepository)
|
||||
{
|
||||
_botFactory = botFactory;
|
||||
_botRepository = botRepository;
|
||||
}
|
||||
|
||||
// public void CreateBot()
|
||||
// {
|
||||
// // Use the factory to create a new bot
|
||||
// return _botFactory.CreateBot();
|
||||
// }
|
||||
|
||||
// public void LoadBotBackup(BotBackup botBackup)
|
||||
// {
|
||||
// // Deserialize the JSON into a Bot object
|
||||
// var bot = JsonConvert.DeserializeObject<Bot>(json);
|
||||
|
||||
// return bot;
|
||||
// }
|
||||
|
||||
public async void SaveBotBackup(BotBackup botBackup)
|
||||
{
|
||||
await _botRepository.InsertBotAsync(botBackup);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user