aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-02-02 18:31:20 +0200
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-02-02 18:31:20 +0200
commita7709358f6a6575e9dd42ec1eabf74d8b552cf3a (patch)
tree2c1ba226f12c0948a38f24dc56ec09c29b9027a8 /src
parent753b68265f6b6bcad510dc9c39c935b56c3c407f (diff)
downloadDevHive-a7709358f6a6575e9dd42ec1eabf74d8b552cf3a.tar
DevHive-a7709358f6a6575e9dd42ec1eabf74d8b552cf3a.tar.gz
DevHive-a7709358f6a6575e9dd42ec1eabf74d8b552cf3a.zip
Fixed post files updating in api
Diffstat (limited to 'src')
-rw-r--r--src/DevHive.Data/Repositories/PostRepository.cs5
-rw-r--r--src/DevHive.Web/Controllers/PostController.cs2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/DevHive.Data/Repositories/PostRepository.cs b/src/DevHive.Data/Repositories/PostRepository.cs
index 623a8f8..0fec435 100644
--- a/src/DevHive.Data/Repositories/PostRepository.cs
+++ b/src/DevHive.Data/Repositories/PostRepository.cs
@@ -63,9 +63,10 @@ namespace DevHive.Data.Repositories
.CurrentValues
.SetValues(newEntity);
- post.FileUrls.Clear();
+ List<string> fileUrls = new();
foreach(var fileUrl in newEntity.FileUrls)
- post.FileUrls.Add(fileUrl);
+ fileUrls.Add(fileUrl);
+ post.FileUrls = fileUrls;
post.Comments.Clear();
foreach(var comment in newEntity.Comments)
diff --git a/src/DevHive.Web/Controllers/PostController.cs b/src/DevHive.Web/Controllers/PostController.cs
index ea9a1cd..0a5cf73 100644
--- a/src/DevHive.Web/Controllers/PostController.cs
+++ b/src/DevHive.Web/Controllers/PostController.cs
@@ -56,7 +56,7 @@ namespace DevHive.Web.Controllers
#region Update
[HttpPut]
- public async Task<IActionResult> Update(Guid userId, [FromBody] UpdatePostWebModel updatePostWebModel, [FromHeader] string authorization)
+ public async Task<IActionResult> Update(Guid userId, [FromForm] UpdatePostWebModel updatePostWebModel, [FromHeader] string authorization)
{
if (!await this._postService.ValidateJwtForPost(updatePostWebModel.PostId, authorization))
return new UnauthorizedResult();