Пример #1
0
        public async Task <Models.Author> DeleteAuthor(int id)
        {
            var result = await _authorRepository.DeleteAuthor(id);

            Models.Author authorModel = _mapper.Map <Models.Author>(result);
            return(authorModel);
        }
Пример #2
0
 public IActionResult Delete(int authorId)
 {
     if (!authorsRepository.AuthorExists(authorId))
     {
         return(NotFound());
     }
     authorsRepository.DeleteAuthor(authorId);
     return(Ok());
 }
Пример #3
0
        public bool DeleteAuthor(int id)
        {
            var authorToDelete = authorsRepository.GetAuthors().SingleOrDefault(a => a.Id == id);

            if (authorToDelete == null)
            {
                throw new NotFoundException("invalid author to delete");
            }
            return(authorsRepository.DeleteAuthor(id));
        }
Пример #4
0
     public IActionResult Delete(int authorId)
      {
             if(!AuthorsRepository.AuthorExists(authorId))
              {
                     return NotFound();
                 
     }
             AuthorsRepository.DeleteAuthor(authorId);
             return Ok();
         
 }
Пример #5
0
 public IActionResult DeleteAuthor(Guid id)
 {
     _repository.DeleteAuthor(id);
     return(NoContent());
 }