Beispiel #1
0
        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());
            }
        }
Beispiel #2
0
        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
                });
            }
        }
Beispiel #3
0
 public RoutesRepository(ILogger logger)
 {
     _logger = logger;
     _sql    = new RoutesSql();
 }