Ejemplo n.º 1
0
 public static Party ToDataModel(PartyViewModel party)
 {
     return(new Party
     {
         Dormant = party.Dormant,
         PartyId = party.PartyId,
         PartyName = party.PartyName
     });
 }
Ejemplo n.º 2
0
        internal static Candidate ToDataModel(CandidateViewModel candidate)
        {
            return(new Candidate
            {
                CandidateName = candidate.CandidateName,
                Dormant = candidate.Dormant,

                AreaId = candidate.AreaId,
                CandidateId = candidate.CandidateId,
                PartyId = candidate.PartyId,

                Area = candidate.Area != null?AreaViewModel.ToDataModel(candidate.Area) : null,
                           Party = candidate.Party != null?PartyViewModel.ToDataModel(candidate.Party) : null
            });
        }
Ejemplo n.º 3
0
        public static CandidateViewModel ToViewModel(Candidate candidate, int?count)
        {
            return(new CandidateViewModel
            {
                CandidateName = candidate.CandidateName,
                Dormant = candidate.Dormant,

                AreaId = candidate.AreaId,
                CandidateId = candidate.CandidateId,
                PartyId = candidate.PartyId,
                Votes = count,

                Area = candidate.Area != null?AreaViewModel.ToViewModel(candidate.Area) : null,
                           Party = candidate.Party != null?PartyViewModel.ToViewModel(candidate.Party) : null
            });
        }