aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Web/Controllers/UserController.cs
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-01-19 19:34:38 +0200
committertranstrike <transtrike@gmail.com>2021-01-19 19:34:38 +0200
commit84961acf2520bf7df3dab8c38de287a62313253d (patch)
treeed1ebd2387ffd717295b7ae52c090a8ec5604ba6 /src/DevHive.Web/Controllers/UserController.cs
parent3203ba85dd1948096547608791d82ce83ce123be (diff)
downloadDevHive-84961acf2520bf7df3dab8c38de287a62313253d.tar
DevHive-84961acf2520bf7df3dab8c38de287a62313253d.tar.gz
DevHive-84961acf2520bf7df3dab8c38de287a62313253d.zip
Implemented HttpPatch
Diffstat (limited to 'src/DevHive.Web/Controllers/UserController.cs')
-rw-r--r--src/DevHive.Web/Controllers/UserController.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/DevHive.Web/Controllers/UserController.cs b/src/DevHive.Web/Controllers/UserController.cs
index dc27cbf..7f4e80b 100644
--- a/src/DevHive.Web/Controllers/UserController.cs
+++ b/src/DevHive.Web/Controllers/UserController.cs
@@ -12,6 +12,8 @@ using DevHive.Services.Models.Language;
using DevHive.Web.Models.Technology;
using DevHive.Services.Models.Technology;
using DevHive.Services.Interfaces;
+using DevHive.Data.Models;
+using Microsoft.AspNetCore.JsonPatch;
namespace DevHive.Web.Controllers
{
@@ -101,6 +103,17 @@ namespace DevHive.Web.Controllers
return new AcceptedResult("UpdateUser", userWebModel);
}
+
+ [HttpPatch]
+ public async Task<IActionResult> Patch(Guid id, [FromBody] JsonPatchDocument<User> jsonPatch)
+ {
+ UserServiceModel userServiceModel = await this._userService.PatchUser(id, jsonPatch);
+
+ if (userServiceModel == null)
+ return new BadRequestObjectResult("Wrong patch properties");
+ else
+ return new OkObjectResult(this._userMapper.Map<UserWebModel>(userServiceModel));
+ }
#endregion
#region Delete