public IActionResult Get(int authorsId) { if (!authorsRepository.AuthorExists(authorsId)) { return(NotFound()); } return(Ok(authorsRepository.GetAuthor(authorsId))); }
[HttpPut("{authorId}")]//for updating objects public IActionResult Put(int authorId, [FromBody] Author author) { if (authorId != author.Id) { return(BadRequest()); } if (!authorsRepository.AuthorExists(authorId)) { return(NotFound()); } authorsRepository.UpdateAuthor(author); return(Ok(author)); }
public IActionResult Put(int authorId, [FromBody] Author author) { if(authorId != author.Id) { return BadRequest(); } if(!AuthorsRepository.AuthorExists(authorId)) { return NotFound(); } AuthorsRepository.UpdateAuthor(author); return Ok(author); }
public bool CoachExists(string id) { return(_authorRepo.AuthorExists(id)); }