Beispiel #1
0
        public async Task CreateArticle()
        {
            var request  = new FortnoxApiRequest(this.connectionSettings.AccessToken, this.connectionSettings.ClientSecret);
            var response = await ArticleService.CreateArticleAsync(request, new Article { Description = "TestArtikel" });

            Assert.AreEqual("TestArtikel", response.Description);

            await ArticleService.DeleteArticleAsync(request, response.ArticleNumber);
        }
Beispiel #2
0
        public async Task <IActionResult> DeleteArticle(int articleId)
        {
            var deletedArticle = await articleService.GetArticleAsync(articleId);

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

            await articleService.DeleteArticleAsync(articleId);

            return(NoContent());
        }
Beispiel #3
0
        public async Task <IActionResult> DeleteArticle(
            [HttpTrigger(AuthorizationLevel.Anonymous, "delete", Route = "articles/{articleId}")]
            HttpRequest request, int articleId)
        {
            var deletedArticle = await service.GetArticleAsync(articleId);

            if (deletedArticle == null)
            {
                return(new NotFoundObjectResult($"Article with id: {articleId} not found."));
            }

            await service.DeleteArticleAsync(articleId);

            return(new NoContentResult());
        }
Beispiel #4
0
 protected async Task DeleteArticle(string articleId)
 {
     var request = new FortnoxApiRequest(connectionSettings.AccessToken, connectionSettings.ClientSecret);
     await ArticleService.DeleteArticleAsync(request, articleId);
 }