protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Beer b = new PremiumBeer();
                b.Name = "Primator";
                b.Weight = b.InitialWeight = 645;
                b.Country = "CZECH";

                using (TweetBeerContainer dbContainer = new TweetBeerContainer())
                {
                    #region Inserting

                    dbContainer.AddToBeer(b);
                    dbContainer.SaveChanges();

                    #endregion

                    #region Updating

                    b.Name = "Corona";
                    dbContainer.SaveChanges();

                    #endregion

                    #region Delete

                    //dbContainer.DeleteObject(b);
                    //dbContainer.SaveChanges();

                    #endregion

                    #region LINQ Query

                    var coronas = from beer in dbContainer.Beer.ToList()
                                  where beer.Name == "Corona"
                                  select beer;

                    #endregion
                }

                #region Equivalent to using

                //TweetBeerContainer v = null;
                //try
                //{
                //    v = new TweetBeerContainer();
                //    // Fazer um monte de coisa
                //}
                //catch
                //{
                //}
                //finally
                //{
                //    v.Dispose();
                //}

                #endregion
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Exercício: Preencher DropDownList do controle
            // com as cervejas que estiverem no banco de dados TweetBeer!
            // Lembrem-se: cada item terá um value (Id) e um text (Name)
            // Lembrem-se 2: este carregamento deve ser executado apenas uma vez!

            if (!IsPostBack)
            {
                using (TweetBeerContainer dbContainer = new TweetBeerContainer())
                {
                    var listItems = (from b in dbContainer.Beer.ToList()
                                 select new ListItem(b.Name, b.Id.ToString())).ToArray();

                    foreach (var li in listItems)
                    {
                        if (this.ddlBeerList.Items
                            .Cast<ListItem>()
                            .Count(x => x.Text == li.Text) == 0)
                        {
                            this.ddlBeerList.Items.Add(li);
                        }
                    }
                }
            }
        }