示例#1
0
 public GetPersonInfoDto Map(Person source)
 {
     return(new GetPersonInfoDto
     {
         Id = source.Id,
         BirthDate = source.BirthDate,
         CityId = source.CityId,
         CityName = source.City.Name,
         FirstName = source.Name.FirstName,
         GenderTypeId = source.GenderTypeId,
         GenderTypeName = source.GenderType?.Name,
         LastName = source.Name.LastName,
         PersonalNumber = source.PersonalNumber,
         ImagePath = !string.IsNullOrWhiteSpace(source.ImagePath) ? Path.Combine(_photoUploadService.GetWebRootPath(), source.ImagePath) : null,
         PhoneNumbers = source.PhoneNumbers.Select(p => _phoneNumberMapper.Map(p)),
         Relations = source.DirectRelatedPersons.Select(r => _relationMapper.Map(r)),
     });
 }
 public GetPersonListDto MapToGetPersonListDto(Person source)
 {
     return(new GetPersonListDto
     {
         Id = source.Id,
         BirthDate = source.BirthDate.Value,
         CityId = source.CityId,
         CityName = source.City.Name,
         FirstName = source.Name.FirstName,
         LastName = source.Name.LastName,
         GenderTypeId = source.GenderTypeId,
         GenderTypeName = source.GenderType?.Name,
         PersonalNumber = source.PersonalNumber,
         ImagePath = !string.IsNullOrWhiteSpace(source.ImagePath) ? Path.Combine(_photoUploadService.GetWebRootPath(), source.ImagePath) : null
     });
 }