| 1234567891011121314151617181920212223242526272829 |
- using Diligent.WebAPI.Contracts.DTOs.User;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace Diligent.WebAPI.Business.MappingProfiles
- {
- [ExcludeFromCodeCoverage]
- public class UserMappingProfile : Profile
- {
- public UserMappingProfile()
- {
- #region DTO to Model
- CreateMap<CreateUserRequestDto, User>();
- CreateMap<RegisterDTO, User>().ForMember(n => n.PhoneNumber, opt => opt.MapFrom(n => n.Phone));
- #endregion
-
- #region Model to DTO
- CreateMap<User, UserResponseDTO>();
- CreateMap<User, UserDetailsResponseDTO>()
- .ForMember(dest => dest.PhoneNumber, opt => opt.NullSubstitute("User has no phone number saved."))
- .ForMember(dest => dest.Position, opt => opt.NullSubstitute("Position has not been declared yet."))
- .ForMember(dest => dest.LinkedIn, opt => opt.NullSubstitute("User takes no part in any social media."));
- #endregion
- }
- }
- }
|