public IActionResult Post([FromBody] AuthorRequestBody body) { var author = authorService.Add(body.MapTo <AuthorToAddOrUpdate>()); return(this.CreateHalResponse(author.MapTo <AuthorResponseBody>()) .AddLink(LinkTemplates.Author.Self) .AddLocationHeader(this, author.Id) .ToActionResult(this, HttpStatusCode.Created)); }
public IActionResult Put(int id, [FromBody] AuthorRequestBody body) { var author = authorService.Update(id, body.MapTo <AuthorToAddOrUpdate>()); if (author == null) { return(NotFound()); } return(this.CreateHalResponse(author.MapTo <AuthorResponseBody>()) .AddLink(LinkTemplates.Author.Self) .ToActionResult(this)); }