create an IEnumerable of Employee and add the connection string, dapper Using statement in EmployeeProvider.cs
using System.Data.SqlClient;
using Dapper;
using TimeManagement.Data;
namespace TimeManagement.Data
{
public class EmployeeProvider : IEmployeeProvider
{
private readonly string connectionString;
public EmployeeProvider(string connectionString)
{
this.connectionString = connectionString;
}
public IEnumerable<Employee> Get()
{
IEnumerable<Employee> employee = null;
using (var connection = new SqlConnection(connectionString))
{
employee = connection.Query<Employee>(
"select id, first_name as FirstName, last_name as LastName, address, home_phone as HomePhone, cell_phone as CellPhone from Employee");
}
return employee;
}
}
}
create an IEnumerable of Employee and add the connection string, dapper Using statement in EmployeeProvider.cs