public async Task <List <Route> > ByTurnoverId(int turnoverId) { using (var conn = new SqlConnection(AppSettings.ConnectionString)) { var sql = new RoutesSql(); var result = await conn.QueryAsync <Route>(sql.ByTurnoverId(turnoverId)); return(result.ToList()); } }
public async Task <RoutesByTurnoverIdPaging> GetByTurnoverIdPaging(int turnoverId, int skip, int limit) { using (var conn = new SqlConnection(AppSettings.ConnectionString)) { var sql = new RoutesSql(); var routes = await conn.QueryAsync <Route>(sql.GetByTurnoverIdPaging(turnoverId, skip, limit)); var count = await conn.ExecuteScalarAsync <int>(_sql.CountByTurnoverId(turnoverId)); return(new RoutesByTurnoverIdPaging { Data = routes.ToList(), Total = count }); } }
public RoutesRepository(ILogger logger) { _logger = logger; _sql = new RoutesSql(); }