public async Task <ReviewDto> UpdateAsync(Guid id, ReviewCreateUpdateDto input) { var review = await _repository.GetAsync(id); if (review.UserId != CurrentUser.GetId()) { throw new UserFriendlyException(L["NoPermissons"]); } review.Update(input.Content); return(ObjectMapper.Map <Review, ReviewDto>(review)); }
public async Task <ReviewDto> CreateAsync(ReviewCreateUpdateDto input) { Guid? rootId = null; string ipAddress = "", userAgent = ""; if (input.ParentId.HasValue) { var parent = await _repository.GetAsync(input.ParentId.Value); rootId = parent.ParentId.HasValue ? parent.RootId : parent.Id; } var review = new Review(GuidGenerator.Create(), CurrentUser.TenantId, CurrentUser.GetId(), input.ModuleName, input.SubjectId, input.ParentId, rootId, input.Content, ipAddress, userAgent); review = await _repository.InsertAsync(review); return(ObjectMapper.Map <Review, ReviewDto>(review)); }
public Task <ReviewDto> UpdateAsync(Guid id, ReviewCreateUpdateDto input) { return(_service.UpdateAsync(id, input)); }
public Task <ReviewDto> CreateAsync(ReviewCreateUpdateDto input) { return(_service.CreateAsync(input)); }