diff options
| Commit | 84961acf2520bf7df3dab8c38de287a62313253d (patch) | |
|---|---|---|
| Author | 2021-01-19 19:34:38 +0200 | |
| Committer | 2021-01-19 19:34:38 +0200 | |
| Files | ed1ebd2387ffd717295b7ae52c090a8ec5604ba6 /src/DevHive.Web/Controllers | |
| DevHive-84961acf2520bf7df3dab8c38de287a62313253d.tar DevHive-84961acf2520bf7df3dab8c38de287a62313253d.tar.gz DevHive-84961acf2520bf7df3dab8c38de287a62313253d.zip | ||
| Parent | 3203ba85dd1948096547608791d82ce83ce123be (diff) | |
Implemented HttpPatch
1 files changed, 13 insertions, 0 deletions
| -rw-r--r-- | src/DevHive.Web/Controllers/UserController.cs | 13 |
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 |
