diff options
Diffstat (limited to 'API')
| -rw-r--r-- | API/Controllers/UserController.cs | 8 | ||||
| -rw-r--r-- | API/Service/UserService.cs | 16 |
2 files changed, 22 insertions, 2 deletions
diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index ed3d917..b75d081 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -36,8 +36,12 @@ namespace API.Controllers return await this._service.GetUserById(id); } - // //Update - // [HttpPut] + //Update + [HttpPut] + public async Task<HttpStatusCode> Update(int id, [FromBody] UserDTO userDTO) + { + return await this._service.UpdateUser(id, userDTO); + } // //Delete // [HttpDelete] diff --git a/API/Service/UserService.cs b/API/Service/UserService.cs index b9fe91d..e678b17 100644 --- a/API/Service/UserService.cs +++ b/API/Service/UserService.cs @@ -36,5 +36,21 @@ namespace API.Service 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) + User user = new User{ + Id = id, + FirstName = "Misho", + LastName = "Mishov", + UserName = "cheese" + }; + await this._dbRepository.EditAsync(id, user); + + return HttpStatusCode.OK; + } + } } |
