Exemplo n.º 1
0
 public static Election ToDataModel(ElectionViewModel election)
 {
     return(new Election
     {
         ElectionId = election.ElectionId,
         ElectionName = election.ElectionName,
         ElectionType = election.ElectionType,
         Country = election.Country,
         EndDate = election.EndDate,
         StartDate = election.StartDate,
         Dormant = election.Dormant,
         Candidates = election.Candidates.Select(x => CandidateViewModel.ToDataModel(x)).ToList()
     });
 }
Exemplo 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
            });
        }
Exemplo n.º 3
0
 public static ElectionViewModel ToViewModel(Election election)
 {
     return(new ElectionViewModel
     {
         ElectionId = election.ElectionId,
         ElectionName = election.ElectionName,
         ElectionType = election.ElectionType,
         Country = election.Country,
         EndDate = election.EndDate,
         StartDate = election.StartDate,
         Dormant = election.Dormant,
         Candidates = election.Candidates != null?election.Candidates.Select(x => CandidateViewModel.ToViewModel(x, null)).ToList() : null
     });
 }