예제 #1
0
        public async Task <ActionResult <NewsFeedPublication> > CreateAsync(
            [FromBody] CreateNewsFeedPublication content)
        {
            var publication = await newsFeedStorage.PublishAsync(content.Content, currentUserProvider.UserId);

            return(Created(string.Empty, publication));
        }
예제 #2
0
        public async Task <ActionResult> UpdateAsync(
            [FromRoute] string publicationId,
            [FromBody] CreateNewsFeedPublication model)
        {
            var publication = await newsFeedStorage.GetByIdAsync(publicationId);

            if (publication == null)
            {
                return(NotFound());
            }

            if (publication.Author.Id.ToString() != currentUserProvider.UserId)
            {
                return(Forbid());
            }

            await newsFeedStorage.UpdateAsync(publicationId, model.Content);

            return(NoContent());
        }