public IQueryable<Property> SearchPropertiesByUser(SearchQuery search)
        {
            //Finding user that matches SearchQuery's username
            string username = search.UserName;
            var user = db.Users.FirstOrDefault(u => u.UserName == username);

            //Returns all properties that have associated username's userId
            IQueryable<Property> properties = db.Properties.Where(p => p.UserId == user.Id);
            return properties;
        }
        public IQueryable<Property> SearchProperties(SearchQuery search)
        {
            //Building SQL query based on null values in SearchQuery object
            IQueryable<Property> properties = db.Properties;
            if (!String.IsNullOrEmpty(search.City))
            {
                properties = properties.Where(p => p.City == search.City);
            }

            if (search.MinRent > 0 && search.MinRent != null)
            {
                properties = properties.Where(p => p.Rent >= search.MinRent);
            }

            if (search.MaxRent > 0 && search.MaxRent != null)
            {
                properties = properties.Where(p => p.Rent <= search.MaxRent);
            }

            if (search.Bedrooms > 0 && search.Bedrooms != null)
            {
                properties = properties.Where(p => p.Bedrooms >= search.Bedrooms);
            }

            if (search.Bathrooms > 0 && search.Bathrooms != null)
            {
                properties = properties.Where(p => p.Bathrooms >= search.Bathrooms);
            }

            //Returns results of search query
            return properties;
        }