public static Party ToDataModel(PartyViewModel party) { return(new Party { Dormant = party.Dormant, PartyId = party.PartyId, PartyName = party.PartyName }); }
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 }); }
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 }); }