Exemplo n.º 1
0
        public PartyCongressCandidateSectionViewModel(Entities.Party party, IPartyService partyService) : base(party.Country)
        {
            Info    = new PartyInfoViewModel(party);
            PartyID = party.ID;

            var entity     = SessionHelper.CurrentEntity;
            var lastVoting = party.Country.GetLastCongressCandidateVoting();


            var candidate = lastVoting.CongressCandidates.FirstOrDefault(c => c.CandidateID == entity.EntityID);

            if (candidate != null)
            {
                PlayerCongressCandidateStatus = (CongressCandidateStatusEnum)candidate.CongressCandidateStatusID;
            }
            if (entity.Citizen != null)
            {
                if (partyService.CanAcceptCongressCandidates(entity.Citizen, party))
                {
                    CanAcceptCandidates = true;
                }

                if (partyService.CanCandidateToCongress(entity.Citizen, party))
                {
                    CanCandidate        = true;
                    CandidateRegionName = entity.GetCurrentRegion().Name;
                }
            }
        }
Exemplo n.º 2
0
        public ActionResult CandidateToCongress()
        {
            var citizen = SessionHelper.CurrentEntity.Citizen;

            if (citizen == null)
            {
                return(RedirectToHome());
            }

            if (partyService.CanCandidateToCongress(citizen, citizen.PartyMember.Party) == false)
            {
                return(RedirectToHome());
            }

            partyService.CandidateToCongress(citizen);
            AddInfo("You sucessfuly candidated to congress! <br/> Now you need to wait for approval from party president.");
            return(RedirectToAction("View", new { partyID = citizen.PartyMember.PartyID }));
        }