Moved to System.Text.Json - Removed all Library dependencies - Implemented DeleteCommand

This commit is contained in:
2025-02-04 13:28:06 +03:30
parent d716133230
commit 83347587e4
10 changed files with 171 additions and 121 deletions

View File

@@ -1,4 +1,3 @@
using Microsoft.Extensions.Logging;
using TBDel.Models;
using TBDel.Services;

View File

@@ -2,7 +2,7 @@ using TBDel.Services;
namespace TBDel.Commands;
public class DeleteCommand
public class DeleteCAllCommand
{
public static async Task DeleteAll()
{

View File

@@ -0,0 +1,35 @@
using TBDel.Models;
using TBDel.Services;
namespace TBDel.Commands;
public class DeleteCommand
{
// Will be done by unique file Id
public static async Task DeleteEntry(string[] args)
{
var dbService = new DbService();
if (args.Length > 1)
{
if (File.Exists(args[1]))
{
Console.WriteLine($"Deleteing file: {args[1]}");
if (await dbService.RemoveFileEntryAsync(args[1]))
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("File deleted successfully");
Console.ResetColor();
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("something went wrong");
Console.ResetColor();
}
}
}
}
}