Exemple #1
0
        /// <summary>
        /// Executes the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        public void Execute(MarkCommentAsSpamCommand command)
        {
            Momento momento = _database.SingleOrDefault <Momento>((m) => m.Id == command.MomentoId);

            momento.MarkCommentAsSpam(command.CommentId);

            _database.Add(momento);
        }
Exemple #2
0
        /// <summary>
        /// Executes the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        public void Execute(CreateCommentCommand command)
        {
            Momento momento = _database.SingleOrDefault <Momento>(c => c.Id == command.MomentoId);
            Comment comment = new Comment();

            comment.Author      = comment.Author;
            comment.AuthorEmail = command.AuthorEmail;
            comment.AuthorUrl   = command.AuthorUrl;
            comment.Body        = comment.Body;
            comment.UserAgent   = command.UserAgent;
            comment.UserIp      = command.UserIp;

            momento.AddComment(comment);

            _database.Add(momento);
            _database.Save();

            CommentMessage commentMessage = ConvertToCommentMessage(comment);

            _bus.Send(commentMessage);
        }
Exemple #3
0
        /// <summary>
        /// Checks for duplicate username.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <returns></returns>
        private User CheckForDuplicateUsername(User user)
        {
            var foundUser = _database.SingleOrDefault <User>((u) => u.Username == user.Username);

            return(foundUser);
        }