public void Delete(int commentId)
        {
            MonumentComment comment = this.GetById(commentId);

            comment.IsDeleted = true;
            this.dbContext.SaveChanges();
        }
        public void Create_ShouldCreateNewCommentCorrectly()
        {
            int    monumentId = 1;
            string username   = "******";

            this.dbContext.Monuments.Add(new Monument {
                Id = monumentId
            });
            this.dbContext.Users.Add(new MbUser {
                UserName = username
            });
            this.dbContext.SaveChanges();

            string content = "testContent";

            this.monumentCommentsService.Create(monumentId, content, username);
            MonumentComment result = this.dbContext.MonumentComments.First();

            result.ShouldSatisfyAllConditions
            (
                () => result.MonumentId.ShouldBe(monumentId),
                () => result.Content.ShouldBe(content),
                () => result.User.UserName.ShouldBe(username)
            );
        }
        public bool CheckForExistingLike(int commentId, string username)
        {
            MonumentComment comment = this.GetById(commentId);
            MbUser          user    = this.usersService.GetByUsername(username);

            bool result = this.dbContext.MonumentCommentLikes.Any(x => x.MonumentComment == comment && x.User == user);

            return(result);
        }
        public void Like(int commentId, string username)
        {
            MonumentComment comment = this.GetById(commentId);
            MbUser          user    = this.usersService.GetByUsername(username);

            var like = new MonumentCommentLike
            {
                MonumentComment = comment,
                User            = user,
            };

            this.dbContext.MonumentCommentLikes.Add(like);
            this.dbContext.SaveChanges();
        }
        public void Dislike(int commentId, string username)
        {
            MonumentComment comment = this.GetById(commentId);
            MbUser          user    = this.usersService.GetByUsername(username);

            var like = this.dbContext.MonumentCommentLikes.SingleOrDefault(x => x.MonumentComment == comment && x.User == user);

            if (like == null)
            {
                throw new LikeNullException();
            }

            this.dbContext.MonumentCommentLikes.Remove(like);
            this.dbContext.SaveChanges();
        }
        public MonumentComment GetById(int commentId)
        {
            MonumentComment comment = this.dbContext.MonumentComments.FirstOrDefault(x => x.Id == commentId);

            if (comment == null)
            {
                throw new CommentNullException();
            }

            if (comment.IsDeleted == true)
            {
                throw new CommentDeletedException();
            }

            return(comment);
        }
        public void Create(int monumentId, string content, string username)
        {
            if (string.IsNullOrWhiteSpace(content))
            {
                throw new ArgumentNullException(nameof(content));
            }

            MbUser   user     = this.usersService.GetByUsername(username);
            Monument monument = this.monumentsService.GetById(monumentId);

            var monumentComment = new MonumentComment
            {
                Content  = content,
                Monument = monument,
                User     = user,
            };

            this.dbContext.MonumentComments.Add(monumentComment);
            this.dbContext.SaveChanges();
        }