コード例 #1
0
        /// <summary>
        /// Executes the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        public void Execute(HomeIndexCommand command)
        {
            User momento = new User();

            //momento.Visibility = Visibility.Private;
            _database.Add(momento);
            _database.Save();
        }
コード例 #2
0
ファイル: PostHandler.cs プロジェクト: alistair/fubumvc.blog
        public BasicInformationViewModel Execute(EditBasicInformationInputModel inputModel)
        {
            var user = inputModel.DynamicMap <User>();

            user.Id = _securityContext.CurrentIdentity.Name;

            _database.Save(user);

            return(user.DynamicMap <BasicInformationViewModel>());
        }
コード例 #3
0
 public void Execute(UpdateCommentInputModel inputModel)
 {
     _database.Save(new Comment(inputModel.Id)
     {
         ArticleUri    = inputModel.Uri,
         Body          = inputModel.Comment,
         Author        = inputModel.Author,
         PublishedDate = DateTime.Now
     });
 }
コード例 #4
0
ファイル: PostHandler.cs プロジェクト: alistair/fubumvc.blog
        public void Execute(CommentInputModel inputModel)
        {
            _database.Increment <Article>(inputModel.Uri, x => x.CommentsCount);

            _database.Save(new Comment(Guid.NewGuid())
            {
                ArticleUri    = inputModel.Uri,
                Body          = inputModel.Comment,
                Author        = inputModel.Author,
                PublishedDate = DateTime.Now
            });
        }
コード例 #5
0
ファイル: PostHandler.cs プロジェクト: alistair/fubumvc.blog
        public ComposeArticleResourceModel Execute(ComposeArticleInputModel inputModel)
        {
            _database.Save(new Article
            {
                AuthorId      = _securityContext.CurrentIdentity.Name,
                Body          = inputModel.Body,
                CommentsCount = inputModel.CommentsCount,
                Id            = inputModel.Id,
                Title         = inputModel.Title,
                PublishedDate = DateTime.Now,
                IsPublished   = !inputModel.IsDraft
            });

            return(new ComposeArticleResourceModel
            {
                Url = inputModel.Id,
                ManageUrl = _urlRegistry.UrlFor <ManageArticlesInputModel>()
            });
        }
コード例 #6
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);
        }