// GET: Result
 public ActionResult Index(string id)
 {
     if (string.IsNullOrWhiteSpace(id))
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     ResultModel resultModel = new ResultModel();
     var resultFormHelper = GetVotesById(id);
     if (!resultFormHelper.Any())
     {
         resultModel = GetNamelessResultModel(id);
         if (resultModel.QuestionContent == null)
         {
             return new HttpStatusCodeResult(HttpStatusCode.NotFound);
         }
         return View(resultModel);
     }
     resultModel = GetNamelessResultModel(id);
     if (resultModel.NamesRequired)
     {
         foreach (var votes in resultFormHelper)
         {
             resultModel.NamedVotes.Add(new ResultHelperNamesVotedFor { name = votes.FullName, answerVotedFor = votes.Answer.Content });
         }
     }
     return View(resultModel);
 }
 private ResultModel GetNamelessResultModel(string id)
 {
     ResultModel resultModel = new ResultModel();
     var poll = GetPollById(id);
     if (!poll.Any())
     {
         return resultModel;
     }
     resultModel.QuestionContent = poll.First().Content;
     resultModel.QuestionUrlId = poll.First().UrlId;
     resultModel.NamesRequired = poll.First().RequireNames;
     resultModel.TotalVotes = poll.First().Votes.Count;
     foreach (var answer in poll.First().Answers)
     {
         resultModel.Answers.Add(new ResultHelperAnswers { answerContent = answer.Content, numVotes = answer.Votes.Count() });
         resultModel.Answers.Last().PreparePercentage(resultModel.TotalVotes);
     }
     resultModel.Answers.Sort((x, y) => y.numVotes.CompareTo(x.numVotes));
     return resultModel;
 }