Exemple #1
0
        public static Core.Community Map(CommunityViewModel data)
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <CommunityViewModel, Core.Community>();
            });
            var mapper = new AutoMapper.Mapper(config);

            Core.Community map = mapper.DefaultContext.Mapper.Map <Core.Community>(data);
            return(map);
        }
Exemple #2
0
        public static Core.Community Map(CommunityViewModel from, Core.Community to)
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <CommunityViewModel, Core.Community>();
                cfg.CreateMap <CommunityTagViewModel, CommunityTag>();
            });
            var mapper = new AutoMapper.Mapper(config);

            Core.Community user = mapper.DefaultContext.Mapper.Map <CommunityViewModel, Core.Community>(from, to);
            return(to);
        }