public void Save(HttpPreferences preferences)
 {
     if (preferences == null)
     {
         throw new ArgumentNullException("preferences");
     }
     HttpCookie cookie = new HttpCookie("preferences") {
         Path = this.controller.Url.Content("~"),
         Expires = DateTime.Now.AddYears(10)
     };
     cookie.Values["vt"] = preferences.VisualTheme;
     cookie.Values["lh"] = preferences.LocationHotel;
     this.controller.HttpContext.Response.Cookies.Set(cookie);
 }
        public void Save(HttpPreferences preferences)
        {
            if (preferences == null)
            {
                throw new ArgumentNullException("preferences");
            }
            HttpCookie cookie = new HttpCookie("preferences")
            {
                Path    = this.controller.Url.Content("~"),
                Expires = DateTime.Now.AddYears(10)
            };

            cookie.Values["vt"] = preferences.VisualTheme;
            cookie.Values["lh"] = preferences.LocationHotel;
            this.controller.HttpContext.Response.Cookies.Set(cookie);
        }
        public HttpPreferences LoadPreferences()
        {
            HttpCookie cookie = this.controller.HttpContext.Request.Cookies["preferences"];

            if ((cookie != null) && (cookie.Values != null))
            {
                HttpPreferences preferences = HttpPreferences.CreateDefault();
                string          str         = cookie.Values["vt"];
                if ((str != null) && HttpPreferences.CheckVisualTheme(str))
                {
                    preferences.VisualTheme = str;
                }
                str = cookie.Values["lh"];
                if ((str != null) && HttpPreferences.CheckLocationHotel(str))
                {
                    preferences.LocationHotel = string.IsNullOrEmpty(str) ? null : str;
                }
                return(preferences);
            }
            return(null);
        }