//this returns the max of any one variable so you can then bind a list or whatever to it public static int?GetHighestNoOfPropertyVariable(PropertyVariables valueToReturn) { PortugalVillasContext _db = new PortugalVillasContext(); int?result = 0; switch (valueToReturn) { case PropertyVariables.MaxSleeps: result = _db.Properties //hotels have stupid numbers .Where(x => x.PropertyTypeID != 2) .Select(x => x.MaxGuests).Max(); break; case PropertyVariables.Bedrooms: result = _db.Properties .Where(x => x.PropertyTypeID != 2) .Select(x => x.Bedrooms).Max(); break; case PropertyVariables.Bathrooms: result = _db.Properties .Where(x => x.PropertyTypeID != 2) .Select(x => x.Bathrooms).Max(); break; default: result = -1; break; } return(result); }
//this returns the max of any one variable so you can then bind a list or whatever to it public static int? GetHighestNoOfPropertyVariable(PropertyVariables valueToReturn) { PortugalVillasContext _db = new PortugalVillasContext(); int? result = 0; switch (valueToReturn) { case PropertyVariables.MaxSleeps: result = _db.Properties //hotels have stupid numbers .Where (x => x.PropertyTypeID != 2) .Select(x => x.MaxGuests).Max(); break; case PropertyVariables.Bedrooms: result = _db.Properties .Where(x => x.PropertyTypeID != 2) .Select(x => x.Bedrooms).Max(); break; case PropertyVariables.Bathrooms: result = _db.Properties .Where(x => x.PropertyTypeID != 2) .Select(x => x.Bathrooms).Max(); break; default: result = -1; break; } return result; }