Example #1
0
        public ActionResult List()
        {
            ListCardsViewModel theModel = new ListCardsViewModel();
            using (BuzzyGo.Repository.BuzzyCardsDataContext ctx = new Repository.BuzzyCardsDataContext(BuzzyGo.Utilities.ConnectionStringHelper.GetCQRSConnectionString()))
            {
                ctx.ObjectTrackingEnabled = false;
                theModel.Cards = ctx.Cards
                    .OrderByDescending(c => c.DateCreated)
                    .ToList();
            }

            CloudHelper.LogMessage(0, String.Format("User view a list of their cards.  There were {0} cards displayed", theModel.Cards.Count.ToString()), "CARD");

            return View(theModel);
        }
Example #2
0
 private CardBuzzWord[] GetBuzzWordArrayForCard(Int32 buzzwordsToRetrieve)
 {
     using (BuzzyGo.Repository.BuzzyCardsDataContext ctx = new Repository.BuzzyCardsDataContext(BuzzyGo.Utilities.ConnectionStringHelper.GetCQRSConnectionString()))
     {
         ctx.ObjectTrackingEnabled = false;
         var allWordsAsList = ctx.Buzzwords
                                 .Select(w => w).ToList();
         var randomSampleWords = allWordsAsList
                                 .OrderBy(r => Guid.NewGuid())
                                 .Take(buzzwordsToRetrieve)
                                 .Select(r => new Model.Card.CardBuzzWord
                                 {
                                     BuzzWordID = r.BuzzID,
                                     BuzzWord = r.Name
                                 })
                                 .ToArray();
         return randomSampleWords;
     }
 }