예제 #1
0
        public Product Get(int ID)
        {
            var mapper = new Mapper(MapperProfile.Configured());

            //IMapper mapper = new MapperConfiguration(x => x.CreateMap<DAL.Product, Product>()).CreateMapper();
            return(mapper.Map <DAL.Product, Product>(_uow.ProductRepository.Get(ID)));
        }
예제 #2
0
        public bool AddProduct(Product item)
        {
            //IMapper mapper = new MapperConfiguration(x => x.CreateMap<Product, DAL.Product>()).CreateMapper();
            //IMapper mapper = new MapperConfiguration(x => x.CreateMap<Product, DAL.Product>().
            //ForMember(dest => dest.Categories, opt => opt.MapFrom(src => src.Categories)).
            //ForMember(dest => dest.Provider, opt1 => opt1.MapFrom(y => y.Provider))).
            //CreateMapper();
            var mapper = new Mapper(MapperProfile.Configured());

            _uow.ProductRepository.Create(mapper.Map <Product, DAL.Product>(item));
            return(true);
        }