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); }
public async Task <IActionResult> DeleteArticle(int articleId) { var deletedArticle = await articleService.GetArticleAsync(articleId); if (deletedArticle == null) { return(NotFound()); } await articleService.DeleteArticleAsync(articleId); return(NoContent()); }
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()); }
protected async Task DeleteArticle(string articleId) { var request = new FortnoxApiRequest(connectionSettings.AccessToken, connectionSettings.ClientSecret); await ArticleService.DeleteArticleAsync(request, articleId); }