diff options
| author | transtrike <transtrike@gmail.com> | 2020-12-10 14:15:38 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2020-12-10 14:15:38 +0200 |
| commit | 6a662373c8300f108ceedaa32b5a076352cb4da6 (patch) | |
| tree | 7adc70ab5829fea4f869906591aa32e4cf55666f /API/Service/UserService.cs | |
| parent | ee80c6ff969b5b4cfc3d1292f15928fc8bd2d667 (diff) | |
| download | DevHive-6a662373c8300f108ceedaa32b5a076352cb4da6.tar DevHive-6a662373c8300f108ceedaa32b5a076352cb4da6.tar.gz DevHive-6a662373c8300f108ceedaa32b5a076352cb4da6.zip | |
Implemented all HTTP Methods
Diffstat (limited to 'API/Service/UserService.cs')
| -rw-r--r-- | API/Service/UserService.cs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/API/Service/UserService.cs b/API/Service/UserService.cs index e678b17..0bc4939 100644 --- a/API/Service/UserService.cs +++ b/API/Service/UserService.cs @@ -20,24 +20,22 @@ namespace API.Service this._dbRepository = new DbRepository<User>(context); } - [HttpPost] public async Task<HttpStatusCode> CreateUser(UserDTO userDTO) { //TODO: MAKE VALIDATIONS OF PROPER REQUEST - //UserDTO newUser = JsonConvert.DeserializeObject<UserDTO>(userDTO); + + //Map UserDTO -> User //await this._dbRepository.AddAsync(newUser); return HttpStatusCode.OK; } - [HttpGet] public async Task<string> GetUserById(int id) { User user = await this._dbRepository.FindByIdAsync(id); return JsonConvert.SerializeObject(user); } - [HttpPut] public async Task<HttpStatusCode> UpdateUser(int id, UserDTO userDTO) { // TODO: add mapper (UserDTO to User) @@ -52,5 +50,11 @@ namespace API.Service return HttpStatusCode.OK; } + public async Task<HttpStatusCode> DeleteUser(int id) + { + await this._dbRepository.DeleteAsync(id); + + return HttpStatusCode.OK; + } } } |
