aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Services/Configurations/Mapping/CommentMappings.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DevHive.Services/Configurations/Mapping/CommentMappings.cs')
-rw-r--r--src/DevHive.Services/Configurations/Mapping/CommentMappings.cs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/DevHive.Services/Configurations/Mapping/CommentMappings.cs b/src/DevHive.Services/Configurations/Mapping/CommentMappings.cs
index f903128..46404da 100644
--- a/src/DevHive.Services/Configurations/Mapping/CommentMappings.cs
+++ b/src/DevHive.Services/Configurations/Mapping/CommentMappings.cs
@@ -1,7 +1,6 @@
using DevHive.Data.Models;
using AutoMapper;
using DevHive.Services.Models.Post.Comment;
-using DevHive.Common.Models.Misc;
namespace DevHive.Services.Configurations.Mapping
{
@@ -9,11 +8,14 @@ namespace DevHive.Services.Configurations.Mapping
{
public CommentMappings()
{
- CreateMap<CommentServiceModel, Comment>();
- CreateMap<Comment, CommentServiceModel>();
- CreateMap<UpdateCommentServiceModel, Comment>();
- CreateMap<IdModel, Comment>();
- CreateMap<Comment, IdModel>();
+ CreateMap<CreateCommentServiceModel, Comment>()
+ .ForMember(src => src.Id, dest => dest.Ignore());
+ CreateMap<UpdateCommentServiceModel, Comment>()
+ .ForMember(src => src.Id, dest => dest.MapFrom(p => p.CommentId));
+
+ CreateMap<Comment, ReadCommentServiceModel>();
+ CreateMap<Comment, UpdateCommentServiceModel>()
+ .ForMember(src => src.CommentId, dest => dest.MapFrom(p => p.Id));
}
}
-} \ No newline at end of file
+}