public IActionResult Post([FromBody] ArticleRequestBody body) { var article = articleService.Add(body.MapTo <ArticleToAddOrUpdate>()); return(this.CreateHalResponse(article.MapTo <ArticleResponseBody>()) .AddLink(LinkTemplates.Article.Self) .AddLocationHeader(this, article.Id) .ToActionResult(this, HttpStatusCode.Created)); }
public IActionResult Put(int id, [FromBody] ArticleRequestBody body) { var article = articleService.Update(id, body.MapTo <ArticleToAddOrUpdate>()); if (article == null) { return(NotFound()); } return(this.CreateHalResponse(article.MapTo <ArticleResponseBody>()) .AddLink(LinkTemplates.Article.Self) .ToActionResult(this)); }