diff options
Diffstat (limited to 'Backend')
-rw-r--r-- | Backend/Api/Api/Models/Post.cs | 5 | ||||
-rw-r--r-- | Backend/Api/Api/Services/PostService.cs | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Backend/Api/Api/Models/Post.cs b/Backend/Api/Api/Models/Post.cs index 8099d6c..baadc24 100644 --- a/Backend/Api/Api/Models/Post.cs +++ b/Backend/Api/Api/Models/Post.cs @@ -18,6 +18,7 @@ namespace Api.Models public List<Rating> ratings { get; set; } public List<Comment> comments { get; set; } public List<File> images { get; set; } + public List<string>? tags { get; set; } } public class PostReceive { @@ -25,8 +26,7 @@ namespace Api.Models public string locationId { get; set; } public string description { get; set; } public List<IFormFile> images { get; set; } - - + public string? tags { get; set; } } public class PostSend { @@ -39,6 +39,7 @@ namespace Api.Models public double ratings { get; set; } public List<CommentSend> comments { get; set; } public List<File> images { get; set; } + public List<string>? tags { get; set; } } public class Rating { diff --git a/Backend/Api/Api/Services/PostService.cs b/Backend/Api/Api/Services/PostService.cs index cc4d064..bdf150b 100644 --- a/Backend/Api/Api/Services/PostService.cs +++ b/Backend/Api/Api/Services/PostService.cs @@ -39,6 +39,8 @@ namespace Api.Services p.comments = new List<Comment>(); p.images = new List<Models.File>(); p.createdAt = DateTime.Now.ToUniversalTime(); + var tags = post.tags.Split("|").ToList(); + p.tags = tags; var folderPath = Path.Combine(Directory.GetCurrentDirectory(), "Files", p.ownerId); if (!Directory.Exists(folderPath)) { @@ -82,6 +84,7 @@ namespace Api.Services p.images = post.images; p.views = post.views.Count(); p.createdAt = post.createdAt; + p.tags = post.tags; if (post.ratings.Count() > 0) { List<int> ratings = new List<int>(); |