diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2020-12-10 11:54:03 +0200 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2020-12-10 11:54:03 +0200 |
| commit | 2b3e8644f4e581874d54ac3950603edafba72bd6 (patch) | |
| tree | bc11cfc6f9dc3f2df8db92376f3a0e710352b002 | |
| parent | 2d1a5bdcafd30dca9d21ac765d9b5f6103129902 (diff) | |
| download | DevHive-2b3e8644f4e581874d54ac3950603edafba72bd6.tar DevHive-2b3e8644f4e581874d54ac3950603edafba72bd6.tar.gz DevHive-2b3e8644f4e581874d54ac3950603edafba72bd6.zip | |
Implemented User get query; disabled friends list
| -rw-r--r-- | API/Controllers/UserController.cs | 8 | ||||
| -rw-r--r-- | API/Service/UserService.cs | 9 | ||||
| -rw-r--r-- | Models/Classes/User.cs | 2 |
3 files changed, 15 insertions, 4 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 +} diff --git a/Models/Classes/User.cs b/Models/Classes/User.cs index e5a83d6..72ecb26 100644 --- a/Models/Classes/User.cs +++ b/Models/Classes/User.cs @@ -60,7 +60,7 @@ namespace Models.Classes } } - public List<User> Friends { get; set; } + // public List<User> Friends { get; set; } /// <summary> /// Throws an argument exception if the given value is not composed only of letters, and if specified, also of digits. |
