public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var livroDelete = await _domainService.GetByIdAsync(id);

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

            await _domainService.DeleteAsync(livroDelete);

            return(RedirectToAction(nameof(Index)));
        }
        public async Task <ActionResult> Delete(long id)
        {
            try
            {
                await _livroService.DeleteAsync(id);

                return(StatusCode(200, "Livro deletado com sucesso"));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "Erro ao deletar, " + ex.Message));
            }
        }
Example #3
0
        public async Task <ActionResult <LivroEntity> > DeleteLivroEntity(int id)
        {
            if (id <= 0)
            {
                return(NotFound());
            }

            var livroEntity = await _livroService.GetByIdAsync(id);

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

            await _livroService.DeleteAsync(id);

            return(livroEntity);
        }
Example #4
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            await _livroService.DeleteAsync(id);

            return(RedirectToAction(nameof(Index)));
        }