public static ElectionViewModel GetElectionViewModel(Election election) { return new ElectionViewModel { Id = election.Id, Date = election.Date, SeatsBundestag = election.SeatsBundestag }; }
private static void GeneratePeopleForWahlkreis(ElectionDBEntities context, Election election, int wahlkreisId, int amountAllowedVoters, int amountVoters) { if (amountAllowedVoters < amountVoters) { throw new Exception( string.Format( "Amount of allowed voters cannot be lower than the amount of all actual voters: {0} < {1}", amountAllowedVoters, amountVoters)); } context.AllowedToElectAmounts.Add(new AllowedToElectAmount { Election_Id = election.Id, Wahlkreis_Id = wahlkreisId, Amount = amountAllowedVoters }); context.ParticipationAmounts.Add(new ParticipationAmount { Election_Id = election.Id, Wahlkreis_Id = wahlkreisId, Amount = amountVoters }); Console.WriteLine("Added {0} allowed voters", amountAllowedVoters); Console.WriteLine("Added {0} actual voters", amountVoters); }