public IEnumerable <ExampleViewModel> GetAllExamples() { IEnumerable <ExampleDTO> temp = studioService.GetAllExamples(); var mapper = new MapperConfiguration(cfg => cfg.CreateMap <ExampleDTO, ExampleViewModel>()).CreateMapper(); var example = mapper.Map <IEnumerable <ExampleDTO>, List <ExampleViewModel> >(temp); return(example); }