public async Task UpdateReplyAsync(UpdateReplyModel updateReplyModel) { ArgumentGuard.NotEmpty(updateReplyModel.Id, nameof(updateReplyModel.Id)); ArgumentGuard.NotNull(updateReplyModel, nameof(updateReplyModel)); //permission await _replyService.UpdateReplyAsync(updateReplyModel); }
public async Task UpdateReplyAsync(SaveReplyModel model, Guid replyId) { var updateReplyModel = new UpdateReplyModel { Id = replyId, Content = model.Content, }; await _replyManager.UpdateReplyAsync(updateReplyModel); }
private bool UpdateReplyEntity(ReplyEntity replyEntity, UpdateReplyModel updateReplyModel) { var requireUpdate = false; if (replyEntity.Content != updateReplyModel.Content) { replyEntity.Content = updateReplyModel.Content; requireUpdate = true; } return(requireUpdate); }
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); }