private void PopulateArticle()
 {
     using (Proje.DataAccess.WebProjeEntities dc = new Proje.DataAccess.WebProjeEntities())
     {
         var v = (from a in dc.icerik
                  join b in dc.ArticleScore on a.icerikid equals b.icerikid into bb
                  from b in bb.DefaultIfEmpty()
                  group new { a, b } by new { a.icerikid, a.icerikYazisi } into AA
                  select new
                  {
                      AA.Key.icerikid,
                      AA.Key.icerikYazisi,
                      Score = AA.Sum(a => a.b.Score) != 0 ? 0 : AA.Sum(a => a.b.Score),
                      Count = AA.Count()
                  });
         List<ArticleWithScore> AWS = new List<ArticleWithScore>();
         foreach (var i in v)
         {
             AWS.Add(new ArticleWithScore
             {
                 icerikid = i.icerikid,
                 icerikYazisi = i.icerikYazisi,
                 Score = i.Score / i.Count
             });
             GridView1.DataSource = AWS;
             GridView1.DataBind();
         }
     }
 }
        private void DisplayQuote(string quote)
        {
            using (RonSwanson_Quotes.RonSwansonQuotes_dbEntities dc = new RonSwanson_Quotes.RonSwansonQuotes_dbEntities())
            {
                var v = (from a in dc.QuotesTables
                         join b in dc.RatingsTables on a.QuoteId equals b.QuoteId into bb
                         from b in bb.DefaultIfEmpty()
                         group new { a, b } by new { a.QuoteId, a.QuoteText } into AA
                         select new
                {
                    AA.Key.QuoteId,
                    AA.Key.QuoteText,
                    Score = AA.Sum(a => a.b.Rating) == null ? 0 : AA.Sum(a => a.b.Rating),
                    Count = AA.Count()
                });

                foreach (var i in v)
                {
                    if (i.QuoteText.Equals(quote))
                    {
                        var DisplayedQuote = new List <QuoteWithRating>();

                        DisplayedQuote.Add(new QuoteWithRating()
                        {
                            QuoteID   = i.QuoteId,
                            QuoteText = i.QuoteText,
                            Rating    = i.Score / i.Count
                        });

                        GridView1.DataSource = DisplayedQuote;
                        GridView1.DataBind();
                    }
                }
            }
        }