diff options
Diffstat (limited to 'API')
| -rw-r--r-- | API/Controllers/UserController.cs | 8 | ||||
| -rw-r--r-- | API/Service/UserService.cs | 9 |
2 files changed, 14 insertions, 3 deletions
diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index b3da7fc..ed3d917 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -30,7 +30,11 @@ namespace API.Controllers } //Read - // [HttpGet] + [HttpGet] + public async Task<string> GetUserById(int id) + { + return await this._service.GetUserById(id); + } // //Update // [HttpPut] @@ -38,4 +42,4 @@ namespace API.Controllers // //Delete // [HttpDelete] } -}
\ No newline at end of file +} diff --git a/API/Service/UserService.cs b/API/Service/UserService.cs index a2d671a..b9fe91d 100644 --- a/API/Service/UserService.cs +++ b/API/Service/UserService.cs @@ -29,5 +29,12 @@ namespace API.Service //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); + } } -}
\ No newline at end of file +} |
