using Microsoft.Data.Sqlite;
using Project.Model;
namespace Project.Persistence;

public partial class SQLite
{
    //get login name and password to compare it with inputs
    public static string? GetLogin(string username)
    {
        using var connection = new SqliteConnection($"Data Source={_dbPath}");
        connection.Open();
        using (var command = connection.CreateCommand())
        {
            command.Parameters.AddWithValue("@loginname", username);
            //command.Parameters.AddWithValue("@loginpass", password);
            command.CommandText =
                @"SELECT loginpass FROM LOGINS WHERE loginname = @loginname
                ";
            var result = command.ExecuteScalar();
            return result?.ToString();
        }
    }
}