public async Task <ActionResult <UserViewModel> > GetUser(string id) { GetUserDTO user = await userService.GetUser(id); var mapper = new MapperConfiguration(cfg => cfg.CreateMap <GetUserDTO, UserViewModel>() .ForMember(p => p.RoleNames, p => p.MapFrom(s => userService.GetUserRoles(s.Id).Result.ToList()))).CreateMapper(); UserViewModel userView = mapper.Map <GetUserDTO, UserViewModel>(user); return(Ok(userView)); }