Esempio n. 1
0
        public static DrinkSelection GetDrinkSelectionByBadgeReference(this SqlDataLayer dataLayer, string badgeReference)
        {
            var query = new SqlQueryBuilder(tableType: typeof(DrinkSelection))
                        .Where(SqlHelpers.BadgeReferenceFieldName, badgeReference, SqlComparisonEnum.Equals);

            return(dataLayer.ExecuteQuery <DrinkSelection>(query).FirstOrDefault());
        }
Esempio n. 2
0
        public static List <Drink> GetDrinksByIdOrName(this SqlDataLayer dataLayer, Guid id, string name)
        {
            var query     = new SqlQueryBuilder(tableType: typeof(Drink));
            var condition = new WhereCondition(tableName: SqlHelpers.TypeToTableName[typeof(Drink)], fieldName: SqlHelpers.IdFieldName, value: id, comparison: SqlComparisonEnum.Equals);

            if (!string.IsNullOrWhiteSpace(name))
            {
                condition.OrWhere(fieldName: SqlHelpers.NameFieldName, value: name);
            }
            query.Where(condition);
            return(dataLayer.ExecuteQuery <Drink>(query));
        }
Esempio n. 3
0
 public static List <T> GetEntities <T>(this SqlDataLayer dataLayer)
     where T : class, new()
 {
     return(dataLayer.ExecuteQuery <T>(new SqlQueryBuilder(tableType: typeof(T))));
 }