Hello,

I have three tables: Polls (PollId, Question), Options (OptionID,
Answer) and Votes (VoteID, OptionID)

I then created two Wrapper Classes:

   PostPaper with the following properties:
      public Poll Poll { get; set; }
      public List<OptionPaper> Options { get; set; }
      public string OptionsCSV { get; set; }

   OptionPaper with the following properties:
      public Option Option { get; set; }
      public int Votes { get; set; }

I need, given an PollId, to get fill a PostPaper with all its options
and for each option count the votes:

      pollViewData.PollPaper = (from p in database.Polls
                                join o in database.Options on p.PollID
equals o.PollID
                                join v in database.Votes on o.OptionID
equals v.OptionID
                                where p.PollID == id
                                group o by p into pog
                                select new PollPaper {
                                  Poll =
pog.Key,
                                  Options = new List<OptionPaper> {
                                    Option = ??????
                                    Votes = ?????
                                  }.ToList(),
                                  OptionsCSV = string.Join(", ",
pog.Select(o => o.Answer).ToArray())
                                }).SingleOrDefault();

I am having problems in creating the Option and Count the votes of
each OptionPaper in List Options.

Could someone, please, help me out?

Thanks,
Miguel

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
 <p><a href="http://feeds.feedburner.com/DotNetDevelopment";><img 
src="http://feeds.feedburner.com/~fc/DotNetDevelopment?bg=99CCFF&amp;fg=444444&amp;anim=1";
 height="26" width="88" style="border:0" alt="" /></a></p>
-~----------~----~----~----~------~----~------~--~---

Reply via email to