public async Task <IActionResult> OnGetAsync(string slug) { WikiPage = await _wikiPageService.FindBySlug(slug); if (WikiPage == null) { return(NotFound()); } MostRecentRevision = await _revisionService.FindMostRecentByPageId(WikiPage.Id); return(Page()); }
public async Task <IActionResult> OnGetAsync(string slug, int revisionNumber) { WikiPage = await _wikiPageService.FindBySlug(slug); if (WikiPage == null) { return(NotFound()); } Revision = await _revisionService.FindByRevisionNumber(WikiPage.Id, revisionNumber); if (Revision == null) { return(NotFound()); } return(Page()); }
public EditApproved(WikiPageRevision revision) { if (revision == null) throw new ArgumentNullException("revision"); Revision = revision; }
public async Task AddRevision(WikiPageRevision revision) { await _collection.InsertOneAsync(revision); }
public EditDenied(WikiPageRevision revision, string reason) { Revision = revision; Reason = reason; }
/// <summary> /// Set the body to a specific revision /// </summary> /// <param name="repository"> Used to parse links </param> /// <param name="revision"> Revision ot use </param> /// <param name="result"> Result from body parsing </param> public virtual void SetRevision(IPageRepository repository, WikiPageRevision revision, PreProcessorContext result) { if (repository == null) throw new ArgumentNullException("repository"); if (revision == null) throw new ArgumentNullException("revision"); if (result == null) throw new ArgumentNullException("result"); UpdatedAt = revision.CreatedAt; UpdatedBy = revision.CreatedBy; RawBody = result.OriginalBody; HtmlBody = result.Body; DomainEvent.Publish(new PageUpdated(this)); UpdateLinksInternal(result, repository); }
private void AddPendingRevision(PreProcessorContext result, string comment, IPageRepository repository) { var revision = new WikiPageRevision(this, WikiContext.Current.User, result, comment) {ReviewRequired = true}; repository.Save(revision); _revisions.Add(revision); DomainEvent.Publish(new RevisionModerationRequired(revision)); }
private void AddRevision(PreProcessorContext result, string comment, IPageRepository repository) { var isNew = !_revisions.Any(); UpdatedAt = DateTime.Now; UpdatedBy = WikiContext.Current.User; RawBody = result.OriginalBody; HtmlBody = result.Body; repository.Save(this); if (isNew) { DomainEvent.Publish(new PageCreated(this)); } else { DomainEvent.Publish(new PageUpdated(this)); } var revision = new WikiPageRevision(this, comment); revision.Approve(); repository.Save(revision); _revisions.Add(revision); }