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); }
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); }