public AccommodationProfiles() { CreateMap <AccommodationPicture, AccommodationPictureDTO>() .ForMember(dest => dest.LocationId, opt => opt.MapFrom( src => src.Accommodation.LocationId)) .ForMember(dest => dest.Picture, opt => opt.MapFrom( src => PictureManagerService.LoadImageFromFile(src.Picture))); CreateMap <AccommodationPictureCreateDTO, AccommodationPicture>(); CreateMap <Accommodation, AccommodationDTO>() .ForMember(dest => dest.Pictures, opt => opt.MapFrom( src => src.Pictures)) .ForMember(dest => dest.Votable, opt => opt.MapFrom( src => src.Votable)) .ForMember(dest => dest.Type, opt => opt.MapFrom( src => src.Type.ToString())) .ReverseMap(); CreateMap <AccommodationCreateDTO, Accommodation>(); CreateMap <AccommodationEditDTO, Accommodation>(); CreateMap <Accommodation, AccommodationRemoveDTO>(); }
public override string getIcon() { if (_seaIcon == null) { lock (_lock) { if (_seaIcon == null) { _seaIcon = PictureManagerService.LoadImageFromFile(_seaIconPath); } } } return(_seaIcon); }
public UserProfiles() { CreateMap<User, UserDTO>() .ForMember(dest => dest.MyTeams, opt => opt.MapFrom( src => src.MyTeams)) .ForMember(dest => dest.MyItems, opt => opt.MapFrom( src => src.MyItems)) .ForMember(dest => dest.MyTrips, opt => opt.MapFrom( src => src.MyTrips)) .ForMember(dest => dest.Picture, opt => opt.MapFrom( src => PictureManagerService.LoadImageFromFile(src.Picture))); CreateMap<User, UserBasicDTO>() .ForMember(dest => dest.Picture, opt => opt.MapFrom( src => PictureManagerService.LoadImageFromFile(src.Picture))); CreateMap<UserRegisterDTO, User>(); CreateMap<UserEditDTO, User>(); CreateMap<User, UserAuthenticateResponseDTO>() .ForMember(dest => dest.Picture, opt => opt.MapFrom( src => PictureManagerService.LoadImageFromFile(src.Picture))); }