diff options
Diffstat (limited to 'API')
| -rw-r--r-- | API/Controllers/UserController.cs | 2 | ||||
| -rw-r--r-- | API/Service/UserService.cs | 5 | ||||
| -rw-r--r-- | API/Startup.cs | 6 |
3 files changed, 5 insertions, 8 deletions
diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index e8a58b8..605b138 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -16,7 +16,7 @@ namespace API.Controllers { private readonly UserService _service; - public UserController(DevHiveContext context, IMapper mapper) + public UserController(DevHiveContext context, Mapper mapper) { this._service = new UserService(context, mapper); } diff --git a/API/Service/UserService.cs b/API/Service/UserService.cs index d84d74b..ce90d0c 100644 --- a/API/Service/UserService.cs +++ b/API/Service/UserService.cs @@ -17,11 +17,10 @@ namespace API.Service private readonly DbRepository<User> _dbRepository; private readonly Mapper _userMapper; - public UserService(DevHiveContext context, IMapper mapper) + public UserService(DevHiveContext context, Mapper mapper) { this._dbRepository = new DbRepository<User>(context); - this._userMapper = new Mapper(new MapperConfiguration(cfg => - cfg.CreateMap<UserDTO, User>())); + this._userMapper = mapper; } public async Task<HttpStatusCode> CreateUser(UserDTO userDTO) diff --git a/API/Startup.cs b/API/Startup.cs index 548274c..825c2d4 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -77,13 +77,11 @@ namespace API endpoints.MapControllers();
});
- IMapper configuration = new MapperConfiguration(cfg =>
+ var configuration = new MapperConfiguration(cfg =>
{
- //cfg.DestinationMemberNamingConvention = new ExactMatchNamingConvention();
-
cfg.CreateMap<User, UserDTO>();
cfg.CreateMap<UserDTO, User>();
-
+
}).CreateMapper();
}
}
|
