コード例 #1
0
        public async Task <ActionResult <Veiculo> > DeleteVeiculo(Guid id)
        {
            var veiculo = await _veiculoService.Selecionar(id);

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

            await _veiculoService.Delete(veiculo);

            return(veiculo);
        }
コード例 #2
0
        public async Task <IActionResult> Delete([FromQuery(Name = "id")] int id)
        {
            var item = await _service.Find(id);

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

            await _service.Delete(item);

            return(NoContent());
        }
コード例 #3
0
        public IHttpActionResult Delete(Guid id)
        {
            bool success;

            try
            {
                success = _service.Delete(id);
                return(Ok(success));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
コード例 #4
0
        public async Task <ActionResult <VeiculoDto> > Delete(int id)
        {
            try
            {
                var veiculo = await veiculoService.GetById(id, GetIdUsuarioLogado());

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

                await veiculoService.Delete(id);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(new ErrorResponse(ex.Message)));
            }
        }