示例#1
0
 public static Comment ToContract(this Entities.Comment domain) =>
 new Comment
 {
     Content         = domain.Content,
     CreatedAt       = domain.CreatedAt,
     CreatedByUserId = domain.CreatedByUserId,
     Id                   = domain.Id,
     LastModifiedAt       = domain.LastModified,
     LastModifiedByUserId = domain.ModifiedByUserId,
     Tag                  = domain.Tag,
     WasEdited            = domain.WasEdited,
     SubjectId            = domain.SubjectId
 };
示例#2
0
        public async Task <long> Create(AddCommentModel model)
        {
            var comment = new Entities.Comment(
                content: model.Content,
                createdAt: DateTime.UtcNow,
                tag: model.Tag,
                subjectId: model.SubjectId);

            auditMetadataProvider.AddAuditMetadataToNewEntity(comment);
            dbContext.Add(comment);
            await dbContext.SaveChangesAsync();

            return(comment.Id);
        }