コード例 #1
0
        public ActionResult Delete(int idCategoria)
        {
            try
            {
                var resposta = Requisicao.Delete("http://localhost:5000/api/Categoria?idCategoria=" + idCategoria);
                if (!resposta.IsSuccessStatusCode)
                {
                    Response.StatusCode             = 400;
                    Response.TrySkipIisCustomErrors = true;
                    return(Content("Falha ao excluir categoria"));
                }

                Response.StatusCode = 200;
                return(Content(""));
            }
            catch (Exception ex)
            {
                Response.StatusCode             = 500;
                Response.TrySkipIisCustomErrors = true;
                return(Content(ex.Message));
            }
        }
コード例 #2
0
        public ActionResult Delete(int IdUsuario)
        {
            try
            {
                var resposta = Requisicao.Delete("http://localhost:5000/api/Lancamento?IdUsuario=" + IdUsuario);

                if (!resposta.IsSuccessStatusCode)
                {
                    Response.StatusCode             = 400;
                    Response.TrySkipIisCustomErrors = true;
                    return(Content("Erro ao deletar usuario"));
                }

                Response.StatusCode = 200;
                return(Content(""));
            }
            catch (Exception ex)
            {
                Response.StatusCode             = 500;
                Response.TrySkipIisCustomErrors = true;
                return(Content(ex.Message));
            }
        }