/// <summary>
        /// Create a new FavoriteBeer object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="creationDate">Initial value of the CreationDate property.</param>
        /// <param name="user">Initial value of the User property.</param>
        public static FavoriteBeer CreateFavoriteBeer(global::System.Int32 id, global::System.DateTime creationDate, global::System.String user)
        {
            FavoriteBeer favoriteBeer = new FavoriteBeer();

            favoriteBeer.Id           = id;
            favoriteBeer.CreationDate = creationDate;
            favoriteBeer.User         = user;
            return(favoriteBeer);
        }
        protected void btnAddToFavorites_Click(object sender, EventArgs e)
        {
            string v = ViewState["S"] as string;

            ListItem selectedBeer = this.ucBeerList.SelectedBeer;
            if (selectedBeer != null)
            {
                this.lbFavorites.Items.Add(new ListItem(selectedBeer.Text));

                #region Adding in Database

                using (TweetBeerContainer tweetBeerContainer = new TweetBeerContainer())
                {
                    long id = Int64.Parse(selectedBeer.Value);
                    Beer currentBeer = tweetBeerContainer.Beer
                        .Single(b => b.Id == id);

                    FavoriteBeer favoriteBeer = new FavoriteBeer();
                    favoriteBeer.Beer = currentBeer;
                    favoriteBeer.CreationDate = DateTime.Now;
                    favoriteBeer.User = Session["userName"] as string;

                    tweetBeerContainer.AddToFavoriteBeerSet(favoriteBeer);
                    tweetBeerContainer.SaveChanges();

                    // Twitter
                    currentBeer.Tweet(String.Format("{0} added to favorites by {1}",
                        currentBeer.Name, favoriteBeer.User
                    ));
                }

                #endregion
            }
            // Cleaning up Beer List
            this.ucBeerList.RemoveSelectedBeer();
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the FavoriteBeerSet EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToFavoriteBeerSet(FavoriteBeer favoriteBeer)
 {
     base.AddObject("FavoriteBeerSet", favoriteBeer);
 }
 /// <summary>
 /// Create a new FavoriteBeer object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="creationDate">Initial value of the CreationDate property.</param>
 /// <param name="user">Initial value of the User property.</param>
 public static FavoriteBeer CreateFavoriteBeer(global::System.Int32 id, global::System.DateTime creationDate, global::System.String user)
 {
     FavoriteBeer favoriteBeer = new FavoriteBeer();
     favoriteBeer.Id = id;
     favoriteBeer.CreationDate = creationDate;
     favoriteBeer.User = user;
     return favoriteBeer;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the FavoriteBeerSet EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToFavoriteBeerSet(FavoriteBeer favoriteBeer)
 {
     base.AddObject("FavoriteBeerSet", favoriteBeer);
 }