コード例 #1
0
        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)));
        }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
ファイル: LivroController.cs プロジェクト: fdbva/20GRPED.MVC2
        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);
        }
コード例 #4
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            await _livroService.DeleteAsync(id);

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