public CongressMemberSectionViewModel(List <Entities.Congressman> unorderedCongressmen, Entities.Country country, IPartyRepository partyRepository) { Info = new CongressInfoViewModel(country); var congressmenOrderedByParty = unorderedCongressmen.GroupBy(c => c.Citizen?.PartyMember?.PartyID) .OrderByDescending(x => x.Count()); var partysIDs = congressmenOrderedByParty.Select(c => c.Key).ToList(); var parties = partyRepository.Where(p => partysIDs.Contains(p.ID)).ToList(); foreach (var congressmen in congressmenOrderedByParty) { var party = parties.FirstOrDefault(p => p.ID == congressmen.Key); OrderedMembersByParty.Add(new CongressMembersListViewModel(congressmen.ToList(), party)); } }
public CongressCandidateSectionViewModel(Entities.Country country) { Info = new CongressInfoViewModel(country); CountryRegions = CreateSelectList(country.Regions.ToList(), true, "Select Region"); CountryRegions.Add(new SelectListItem() { Text = "All regions", Value = "ALL" }); CountryParties = CreateSelectList(country.Parties.ToList(), p => p.Entity.Name, p => p.ID, true, "Select Party"); var lastVoting = country.GetLastCongressCandidateVoting(); if (SessionHelper.CurrentEntity.Is(EntityTypeEnum.Citizen)) { CanVote = !lastVoting.HasVoted(SessionHelper.LoggedCitizen) && lastVoting.VotingStatusID == (int)VotingStatusEnum.Ongoing; } VotingStatus = (VotingStatusEnum)lastVoting.VotingStatusID; CountryID = country.ID; VotingDay = lastVoting.VotingDay; DaysLeft = lastVoting.VotingDay - GameHelper.CurrentDay; }
public void Init(Entities.Country country) { Info = new CongressInfoViewModel(country); }
public CandidateViewModel(Entities.Country country) { Info = new CongressInfoViewModel(country); }