From 43336a1e977f33ad49ad8b4851ca449936f93ce6 Mon Sep 17 00:00:00 2001 From: Danail Dimitrov Date: Wed, 7 Apr 2021 19:30:04 +0300 Subject: adding functionality to add and remove friends --- src/Web/DevHive.Web/Controllers/FriendsController.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Web/DevHive.Web/Controllers') diff --git a/src/Web/DevHive.Web/Controllers/FriendsController.cs b/src/Web/DevHive.Web/Controllers/FriendsController.cs index 00d70a4..9f3ec13 100644 --- a/src/Web/DevHive.Web/Controllers/FriendsController.cs +++ b/src/Web/DevHive.Web/Controllers/FriendsController.cs @@ -34,7 +34,9 @@ namespace DevHive.Web.Controllers if (!this._jwtService.ValidateToken(userId, authorization)) return new UnauthorizedResult(); - return null; + return (await this._friendsService.AddFriend(userId, friendId)) ? + new OkResult() : + new BadRequestResult(); } [HttpDelete] @@ -44,7 +46,9 @@ namespace DevHive.Web.Controllers if (!this._jwtService.ValidateToken(userId, authorization)) return new UnauthorizedResult(); - return null; + return (await this._friendsService.RemoveFriend(userId, friendId)) ? + new OkResult() : + new BadRequestResult(); } } } -- cgit v1.2.3