コード例 #1
0
        public async Task <bool> DeleteComment(string photoId, string albumId, string commentId, User requestor)
        {
            var photo = await _photoService.GetPhoto(photoId);

            var comment = await _unitOfWork.Comments.GetFirst(x => x.ReactionId == commentId);

            if (!await _permissionsService.CanDeleteComment(requestor, comment, albumId))
            {
                return(false);
            }
            var photoComment = photo.PhotoComments.FirstOrDefault(x => x.Comment == comment);

            photo.PhotoComments.Remove(photoComment);
            await _unitOfWork.Comments.Delete(comment);

            await _unitOfWork.Photos.Update(photo);

            return(true);
        }