Exemplo n.º 1
0
 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));
 }
Exemplo n.º 3
0
     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);
         
 }
Exemplo n.º 4
0
 public bool CoachExists(string id)
 {
     return(_authorRepo.AuthorExists(id));
 }