Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 public Task <ReviewDto> UpdateAsync(Guid id, ReviewCreateUpdateDto input)
 {
     return(_service.UpdateAsync(id, input));
 }
Ejemplo n.º 4
0
 public Task <ReviewDto> CreateAsync(ReviewCreateUpdateDto input)
 {
     return(_service.CreateAsync(input));
 }