예제 #1
0
        public async Task <IActionResult> Delete(int Id)
        {
            if (Id == 0)
            {
                return(BadRequest());
            }

            try
            {
                var response = await veiculosRepository.Delete(Id);

                if (response == 0)
                {
                    return(NotFound());
                }
                var result = new
                {
                    code = 20000,
                    data = "success"
                };
                return(Ok(result));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
예제 #2
0
        // POST: Veiculos/Delete/5
        public ActionResult Delete(int id)
        {
            _veiculoRepository.Delete(id);

            return(RedirectToAction(nameof(Index)));
        }