public IHttpActionResult Show(int id) { var author = GetAuthorRepository.Show(id); if (author != null) { var output = OutputAuthorModel.CreateOutput(author); return(Ok(output)); } return(BadRequest("Erro ao processar a solicitaçao")); }
public IHttpActionResult Store(InputAuthorModel input) { var author = GetAuthorRepository.Store(InputAuthorModel.Create(input)); if (author != null) { var output = OutputAuthorModel.CreateOutput(author); return(CreatedAtRoute("DefaultApi", new { id = output.Id }, output)); } return(BadRequest("Erro ao processar a solicitaçao")); }
public IHttpActionResult Update(int author_id, InputAuthorModel input) { var author = GetAuthorRepository.Show(author_id); if (author != null) { var update_author = InputAuthorModel.UpdateAuthor(input, author); if (update_author != null) { var updated = GetAuthorRepository.Update(update_author); var output = OutputAuthorModel.CreateOutput(updated); return(Ok(output)); } } return(BadRequest("Erro ao processar a solicitaçao")); }