コード例 #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());
        }
コード例 #2
0
        public ActionResult Delete(BookViewModel book)
        {
            var bookToRemove = _bookApp.GetById(book.BookId);

            _bookApp.Remove(bookToRemove);

            return(Json("Success", JsonRequestBehavior.DenyGet));
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            var bookDomain = _bookApp.GetById(id);

            _bookApp.Remove(bookDomain);

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

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

            ViewBag.Sucesso = "Book Removed!";
            return(RedirectToAction("Index"));
        }
コード例 #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));
            }
        }
コード例 #6
0
 public IActionResult Delete(int id)
 {
     _bookAppService.Remove(id);
     return(NoContent());
 }
コード例 #7
0
        public IActionResult Delete(Guid id)
        {
            _bookAppService.Remove(id);

            return(Response());
        }