29 lines
758 B
C#
29 lines
758 B
C#
using Dapper;
|
|
using FireLance.Models;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace Gsm
|
|
{
|
|
public class GsmRO : GsmDB
|
|
{
|
|
public List<T> LoadRecords<T>(string select, string from, string column, string query, bool exactMatch)
|
|
{
|
|
string command = $"SELECT \"{select}\",*" +
|
|
$"FROM \"main\".\"{from}\"" +
|
|
$"WHERE \"{column}\"";
|
|
|
|
if (exactMatch == true)
|
|
{
|
|
command += $"LIKE \"{query}\"";
|
|
}
|
|
else
|
|
{
|
|
command += $"LIKE \"%{query}%\"";
|
|
}
|
|
|
|
return (List<T>) DBConnection.Query<T>(command, new DynamicParameters());
|
|
}
|
|
}
|
|
}
|