using Dapper;
using Microsoft.Data.Sqlite;
public class TodoList
{
List<Tasc> tascs = new List<Tasc>();
List<Tag> tags = new List<Tag>();
connection.Query<Task, Tag, int>("SELECT * FROM task2 ")
public static void AddTaskCommand(SqliteConnection connection)
{
while (true)
{
Console.WriteLine("Введите название задачи:");
var taskTitle = Console.ReadLine();
if (taskTitle == null || taskTitle.Length <= 3)
{
continue;
}
connection.Execute("INSERT INTO tasks(title) VALUES (@Title)", new
{
Title = taskTitle,
});
break;
}
}
public static void RemoveTaskCommand(SqliteConnection connection)
{
Console.WriteLine("Введите номер задачи для удаления:");
var id = Convert.ToInt32(Console.ReadLine());
connection.Execute("DELETE FROM tasks WHERE id = @Id", new
{
Id = id,
});
}
public static void SetFinishedTaskCommand(SqliteConnection connection)
{
Console.WriteLine("Введите номер задачи для выполнения:");
var id = Convert.ToInt32(Console.ReadLine());
connection.Execute("UPDATE tasks SET finished = NOT finished WHERE id = @Id", new
{
Id = id,
});
}
public static void RemoveAllTasks(SqliteConnection connection)
{
var id = Convert.ToInt32(Console.ReadLine());
connection.Execute("DELETE FROM tasks WHERE id = @Id",
new
{
Id = id
});
}
}