Exemple #1
0
        public override async Task Delete(CommentLikeEntity entity)
        {
            IRepository <ApplicationUserEntity> repositoryOfApplicationUser = new RepositoryOfApplicationUser(context, serviceOfSearch);
            IRepository <CommentEntity>         repositoryOfComment         = new RepositoryOfComment(context, serviceOfSearch);
            var comment = entity.Comment;

            if (comment == null)
            {
                comment = repositoryOfComment.Read(a => a.Id == entity.CommentId);
            }
            comment.CountOfLikes--;
            repositoryOfComment.Update(comment);
            var ApplicationUserOfComment = repositoryOfApplicationUser.Read(a => a.UserProfileId == comment.UserProfileId);

            ApplicationUserOfComment.CountOfLikes--;
            repositoryOfApplicationUser.Update(ApplicationUserOfComment);
            await base.Delete(entity);
        }