public LunchOptionViewModel(int pollId, LunchOption lo, IEnumerable<LunchVote> votes)
        {
            Id = lo.Id;
            PollId = pollId;
            Name = lo.Name;

            var vLookup = votes.ToLookup(v => v.Score, v => v.User.UserName);
            Upvotes = vLookup[1].OrderBy(n => n).ToList();
            Downvotes = vLookup[-1].OrderBy(n => n).ToList();
        }
 public static void OnVote(int pollId, LunchOption option, IEnumerable<LunchVote> votes)
 {
     OnVote(new LunchOptionViewModel(pollId, option, votes));
 }
 public async Task<LunchOption> GetOrAddOption(DatabaseContext dbContext, string name)
 {
     var option = await dbContext.LunchOptions.SingleOrDefaultAsync(o => o.Name == name);
     if (option == null)
     {
         option = new LunchOption { Name = name };
         dbContext.LunchOptions.Add(option);
     }
     return option;
 }