Skip to content

Instantly share code, notes, and snippets.

@corespider
Created July 6, 2020 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corespider/b50f5a58445e7610f72fef2f1d9b8b9d to your computer and use it in GitHub Desktop.
Save corespider/b50f5a58445e7610f72fef2f1d9b8b9d to your computer and use it in GitHub Desktop.
CoreSpider-EmployeeRepository
public class EmployeeRepository
{
public IDbConnection connection
{
get
{
return new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
}
}
public async Task<object> GetEmployeeList()
{
object result = null;
try
{
using (IDbConnection con = connection)
{
string Query = "SELECT EmpID, EmpName, Mobile, PresentAddress, Area, City, Country, Qualification, Email" +
" from EmployeeDetails";
con.Open();
DynamicParameters param = new DynamicParameters();
result = await con.QueryAsync<Employee>(Query, param, commandType: CommandType.Text);
}
return result;
}
catch (Exception ex)
{
throw ex;
}
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment