Esempio n. 1
0
        public async Task <Comment> MakeAsync(CreateCommentDto model)
        {
            model.CheckArgumentIsNull(nameof(model));
            var entity = model.Adapt <Comment>();

            entity.CreateDate = _dateService.UtcNow();
            entity.IP         = AppHttpContext.IpAddress;
            entity.UserAgent  = AppHttpContext.UserAgent;
            entity.SessionId  = AppHttpContext.SessionId;
            entity.Status     = CommentStatus.Waiting;
            if (_userContext.IsAuthenticated)
            {
                entity.UserId = _userContext.UserId;
            }

            return(await Task.FromResult(entity));
        }