public ActionResult Put(CategoriaViewModel categoria)
        {
            try
            {
                var resposta = Requisicao.Put("http://localhost:5000/api/Categoria", categoria);

                if (!resposta.IsSuccessStatusCode)
                {
                    return(View("Error", "Erro ao atualizar categoria"));
                }

                Response.StatusCode             = 200;
                Response.TrySkipIisCustomErrors = true;

                return(Content(""));
            }
            catch (Exception ex)
            {
                return(View("Error:", ex.Message));
            }
        }
        public ActionResult Put(UsuarioViewModel usuario)
        {
            try
            {
                var resposta = Requisicao.Put("http://localhost:5000/api/Usuario", usuario);

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

                Response.StatusCode = 200;
                return(Content(""));
            }
            catch (Exception ex)
            {
                Response.StatusCode             = 500;
                Response.TrySkipIisCustomErrors = true;
                return(Content(ex.Message));
            }
        }
示例#3
0
        public ActionResult Put(AcaoViewModel acao)
        {
            try
            {
                var resposta = Requisicao.Put("http://localhost:5000/api/Acao", acao);

                if (!resposta.IsSuccessStatusCode)
                {
                    Response.StatusCode             = 400;
                    Response.TrySkipIisCustomErrors = true;
                    return(Content("Falha ao excluir Acao"));
                }

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