public ActionResult DeleteConfirmed(int id)
        {
            if (_produtoService.Excluir(id))
            {
                return(RedirectToAction("Index"));
            }

            return(RedirectToAction("ErroAoExcluir"));
        }
        public async Task <IActionResult> Excluir(int codigo)
        {
            try
            {
                bool result = await _service.Excluir(codigo);

                return(Ok(result));
            }
            catch (Exception ex)
            {
                return(UnprocessableEntity(new
                {
                    ex.Message,
                    Status = 422
                }));
            }
        }