public CongressVotingViewModel(Entities.CongressVoting voting) { CreatorID = voting.Citizen.ID; VotingID = voting.ID; CreatorName = voting.Citizen.Entity.Name; CountryID = voting.CountryID; }
static public ViewVotingBaseViewModel Instantiate(Entities.CongressVoting voting, ICongressVotingService congressVotingService) { bool isPlayerCongressman = false; bool canVote = false; var currentEntity = SessionHelper.CurrentEntity; if (currentEntity.Citizen != null) { var citizen = currentEntity.Citizen; if (citizen?.Congressmen.Any(c => c.CountryID == voting.CountryID) == true) { isPlayerCongressman = true; } canVote = congressVotingService.CanVote(citizen, voting); } return(instantiate(voting.GetVotingType(), voting, isPlayerCongressman, canVote)); }