Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public class Customer
public string FirstName { get; set; }
public string LastName { get; set; }
public string ZipCode { get; set; }
public List<Customer> GetCustomersByState(string state)
var dbConnection = new SqlConnection("SomeConnectionString");
string sql = @"SELECT F_Name AS FirstName,
L_Name AS LastName,
Zip_Code AS ZipCode
FROM Customers
WHERE State = @State";
var parameters = new DynamicParameters();
parameters.Add("State", state);
return dbConnection.Query<Customer>(sql, parameters).ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment