aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Web/Controllers/UserController.cs
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2020-12-17 19:13:01 +0200
committertranstrike <transtrike@gmail.com>2020-12-17 19:13:01 +0200
commit94a3b0661106e91ab3a1a523af3c60df131a4f63 (patch)
treed186fe6d0ea18bdefd8e37f83a754d155f4598d2 /src/DevHive.Web/Controllers/UserController.cs
parentf4515fc3ff5fc222a3bdd40c5d4113f9bd79106f (diff)
downloadDevHive-94a3b0661106e91ab3a1a523af3c60df131a4f63.tar
DevHive-94a3b0661106e91ab3a1a523af3c60df131a4f63.tar.gz
DevHive-94a3b0661106e91ab3a1a523af3c60df131a4f63.zip
Friends implementation added. UserController/AddAFriend added
Diffstat (limited to 'src/DevHive.Web/Controllers/UserController.cs')
-rw-r--r--src/DevHive.Web/Controllers/UserController.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/DevHive.Web/Controllers/UserController.cs b/src/DevHive.Web/Controllers/UserController.cs
index 1360bfe..cdb8dc1 100644
--- a/src/DevHive.Web/Controllers/UserController.cs
+++ b/src/DevHive.Web/Controllers/UserController.cs
@@ -9,6 +9,7 @@ using DevHive.Web.Models.Identity.User;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using DevHive.Common.Models.Identity;
+using DevHive.Common.Models;
namespace DevHive.Web.Controllers
{
@@ -39,6 +40,7 @@ namespace DevHive.Web.Controllers
return new OkObjectResult(tokenWebModel);
}
+ //Create
[HttpPost]
[Route("Register")]
[AllowAnonymous]
@@ -52,6 +54,15 @@ namespace DevHive.Web.Controllers
return new CreatedResult("Register", tokenWebModel);
}
+ [HttpPost]
+ [Route("AddAFriend")]
+ public async Task<IActionResult> AddAFriend(Guid userId, [FromBody] IdModel friendIdModel)
+ {
+ return await this._userService.AddFriend(userId, friendIdModel.Id) ?
+ new OkResult() :
+ new BadRequestResult();
+ }
+
//Read
[HttpGet]
public async Task<IActionResult> GetById(Guid id)