Ejemplo n.º 1
0
        public async Task UpdateReplyAsync(UpdateReplyModel updateReplyModel)
        {
            ArgumentGuard.NotEmpty(updateReplyModel.Id, nameof(updateReplyModel.Id));
            ArgumentGuard.NotNull(updateReplyModel, nameof(updateReplyModel));

            //permission
            await _replyService.UpdateReplyAsync(updateReplyModel);
        }
Ejemplo n.º 2
0
        public async Task UpdateReplyAsync(SaveReplyModel model, Guid replyId)
        {
            var updateReplyModel = new UpdateReplyModel
            {
                Id      = replyId,
                Content = model.Content,
            };

            await _replyManager.UpdateReplyAsync(updateReplyModel);
        }
Ejemplo n.º 3
0
        private bool UpdateReplyEntity(ReplyEntity replyEntity, UpdateReplyModel updateReplyModel)
        {
            var requireUpdate = false;

            if (replyEntity.Content != updateReplyModel.Content)
            {
                replyEntity.Content = updateReplyModel.Content;
                requireUpdate       = true;
            }

            return(requireUpdate);
        }
Ejemplo n.º 4
0
        public async Task UpdateReplyAsync(UpdateReplyModel updateReplyModel)
        {
            ArgumentGuard.NotEmpty(updateReplyModel.Id, nameof(updateReplyModel.Id));
            ArgumentGuard.NotNull(updateReplyModel, nameof(updateReplyModel));

            // validate

            var replyEntity = await _replyRepository.GetAsync(updateReplyModel.Id);

            var shouldUpdate = UpdateReplyEntity(replyEntity, updateReplyModel);

            if (!shouldUpdate)
            {
                return;
            }

            replyEntity.LastModfiedById     = _userContext.UserId;
            replyEntity.LastModifiedDateUtc = DateTime.UtcNow;

            await _replyRepository.UpdateAsync(replyEntity);
        }