/// <summary> /// Adds a post to favorites /// </summary> /// <param name="post">a post</param> /// <returns>true/false value indicating if added</returns> public static bool Add(TravelPost post) { bool isAdded = false; Favorites temp = RetrieveFavoritesFromSession(); if (!temp.IsExist(post)) { temp.Add(post); SendFavoritesToSession(temp); isAdded = false; } return(isAdded); }
/// <summary> /// Sends favorites object to session /// </summary> /// <param name="favorites">a favorites object</param> private static void SendFavoritesToSession(Favorites favorites) { HttpContext.Current.Session[SESSION_FAVORITES] = favorites; }