Beispiel #1
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var cont = await _movimento.GetById(id);

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

                _movimento.Delete(cont);

                if (await _movimento.SaveChangesAsync())
                {
                    return(Ok());
                }
            }
            catch (System.Exception)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Banco de dados Falhou"));
            }

            return(BadRequest());
        }