Пример #1
0
        public async Task <ActionResult <ArticleResource> > UpdateArticle([FromRoute][Required] int id, [FromBody][Required] AddArticleResource model, CancellationToken cancellationToken)
        {
            var userId = UserExtension.GetUserId(HttpContext);

            return(Ok(await _service.UpdateArticle(userId, id, model, cancellationToken)));
        }
        public async Task <ActionResult <IEnumerable <ArticleResource> > > GetArticlesByUser(CancellationToken cancellationToken)
        {
            var userId = UserExtension.GetUserId(HttpContext);

            return(Ok(await _service.GetArticlesByUserAsync(userId, cancellationToken)));
        }
Пример #3
0
        public async Task <ActionResult <ArticleResource> > AddArticle([FromBody] AddArticleResource model, CancellationToken cancellationToken)
        {
            var userId = UserExtension.GetUserId(HttpContext);

            return(Ok(await _service.AddArticle(userId, model, cancellationToken)));
        }