Beispiel #1
0
        public async Task <IActionResult> Delete(int ProcessoId)
        {
            try
            {
                var processo = await _repo.GetAllProcessoAsyncById(ProcessoId);

                if (processo == null)
                {
                    return(NotFound());
                }

                _repo.Delete(processo);

                if (await _repo.SaveChangesAssync())
                {
                    return(Ok());
                }

                return(BadRequest());
            }
            catch (System.Exception erro)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, erro.InnerException));
            }
        }
        public async Task <IActionResult> Delete(int ClienteId)
        {
            try
            {
                var cliente = await _repo.GetAllClienteAsyncById(ClienteId);

                if (cliente == null)
                {
                    return(NotFound());
                }

                _repo.Delete(cliente);

                if (await _repo.SaveChangesAssync())
                {
                    return(Ok());
                }

                return(BadRequest());
            }
            catch (System.Exception)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Banco de Dados Falhou"));
            }
        }