public List <Ref_Product_TypesDTO> GetAll() { var lst = dal.GetAll(); if (lst != null) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <Product, Ref_Product_TypesDTO>(); }); IMapper iMapper = config.CreateMapper(); var typeModel = iMapper.Map <List <Ref_Product_Types>, List <Ref_Product_TypesDTO> >(lst); return(typeModel); } return(null); }