Refactored GsmDB
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user