public List <DB_Car> GetCars(TableQuery <DB_Car> query = null) { var findQuery = query ?? CreateCarQuery(); var result = CarStorage.ExecuteQuery(findQuery as TableQuery <DB_Car>); return(result.ToList()); }
public int CountCars(TableQuery <DB_Car> existingQuery = null) { var query = existingQuery ?? CreateCarQuery(); query.SelectColumns = new string[] { "RowKey" }; var results = CarStorage.ExecuteQuery(query).ToList(); return(results.Count()); }
private List <(string Group, int Count)> ListCarsGrouped(string GroupProperty, Func <DB_Car, string> GroupFunc, TableQuery <DB_Car> existingQuery) { var groupQuery = existingQuery ?? CreateCarQuery(); groupQuery.SelectColumns = new string[] { GroupProperty }; var groupedCars = CarStorage.ExecuteQuery(groupQuery as TableQuery <DB_Car>).ToList(); return(groupedCars .GroupBy(GroupFunc) .Where(g => g.Key != null) .Select(group => (Group: group.Key, Count: group.Count())) .ToList()); }