Beispiel #1
0
        public IActionResult DeleteBookForAuthor(Guid authorId, Guid id)
        {
            if (!_authorAppService.AuthorExists(authorId))
            {
                return(NotFound());
            }

            var bookForAuthor = _bookAppService.GetBookForAuthor(authorId, id);

            if (bookForAuthor == null)
            {
                return(NotFound());
            }


            if (!_bookAppService.Remove(id))
            {
                throw new Exception($"Deleting a book {id} for author {authorId} failed on save.");
            }

            _logger.LogInformation(100, $"The book {id} for author {authorId} was deleted.");

            //sucess but don't have a content
            return(NoContent());
        }
        public ActionResult Delete(BookViewModel book)
        {
            var bookToRemove = _bookApp.GetById(book.BookId);

            _bookApp.Remove(bookToRemove);

            return(Json("Success", JsonRequestBehavior.DenyGet));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            var bookDomain = _bookApp.GetById(id);

            _bookApp.Remove(bookDomain);

            return(RedirectToAction("Index"));
        }
Beispiel #4
0
        public IActionResult DeleteConfirmed(Guid id)
        {
            _bookAppService.Remove(id);

            if (!IsValidOperation())
            {
                return(View(_bookAppService.GetById(id)));
            }

            ViewBag.Sucesso = "Book Removed!";
            return(RedirectToAction("Index"));
        }
Beispiel #5
0
        public IActionResult DeleteConfirmed(long id)
        {
            try
            {
                _bookAppService.Remove(id);

                ViewBag.Sucesso = "Book Removed!";

                return(RedirectToAction("Index"));
            }
            catch (ExceptionHandler)
            {
                return(View(_bookAppService.GetById(id).Data));
            }
        }
Beispiel #6
0
 public IActionResult Delete(int id)
 {
     _bookAppService.Remove(id);
     return(NoContent());
 }
Beispiel #7
0
        public IActionResult Delete(Guid id)
        {
            _bookAppService.Remove(id);

            return(Response());
        }