コード例 #1
0
        /// <summary>
        /// Returns all of the available sites from a selected campground, given a reservation date range.
        /// </summary>
        /// <param name="campground">A particular campground object specified by the user.</param>
        /// <param name="start">The start of a reservation date in yyyy-mm-dd format.</param>
        /// <param name="end">the end of a reservation date in yyyy-mm-dd format.</param>
        /// <returns>A dictionary of all available sites from a particular campground in a set date range, with the key being the site ID and the value being the site class object</returns>
        public Dictionary <int, Site> GetSelectedSiteDictionary(Campground campground, string start, string end)
        {
            List <Site>            list           = _db.GetSelectedSites(campground.CampgroundID, start, end);
            Dictionary <int, Site> SiteDictionary = new Dictionary <int, Site>();

            foreach (Site item in list)
            {
                SiteDictionary.Add(item.SiteID, item);
            }
            return(SiteDictionary);
        }