/// <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(); }
public BasicInformationViewModel Execute(EditBasicInformationInputModel inputModel) { var user = inputModel.DynamicMap <User>(); user.Id = _securityContext.CurrentIdentity.Name; _database.Save(user); return(user.DynamicMap <BasicInformationViewModel>()); }
public void Execute(UpdateCommentInputModel inputModel) { _database.Save(new Comment(inputModel.Id) { ArticleUri = inputModel.Uri, Body = inputModel.Comment, Author = inputModel.Author, PublishedDate = DateTime.Now }); }
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 }); }
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>() }); }
/// <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); }