コード例 #1
0
        public IActionResult Delete(int id)
        {
            try
            {
                appService.Delete(id);

                return(Ok(LivroResource.LivroExcluidoSucesso));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
コード例 #2
0
ファイル: LivroController.cs プロジェクト: juninmd/Biblioteca
        public ActionResult ExcluirDados(int idLivro)
        {
            try
            {
                var response = _livroService.Delete(idLivro);
                if (!response.IsSuccessStatusCode)
                {
                    return(Content("Erro ao excluir livro"));
                }

                var livro = JsonConvert.DeserializeObject <IEnumerable <LivroViewModel> >(response.Content.ReadAsStringAsync().Result);
                return(View("_Grid", livro));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }