コード例 #1
0
        public static CommunityTag Map(CommunityTagViewModel data)
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <CommunityTagViewModel, CommunityTag>();
            });
            var          mapper = new AutoMapper.Mapper(config);
            CommunityTag map    = mapper.DefaultContext.Mapper.Map <CommunityTag>(data);

            return(map);
        }
コード例 #2
0
        public static CommunityTag Map(CommunityTagViewModel from, CommunityTag to)
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <CommunityTagViewModel, CommunityTag>();
                cfg.CreateMap <CommunityTagViewModel, CommunityTag>();
            });
            var          mapper = new AutoMapper.Mapper(config);
            CommunityTag user   = mapper.DefaultContext.Mapper.Map <CommunityTagViewModel, CommunityTag>(from, to);

            return(to);
        }