Exemplo n.º 1
0
        public async Task <IActionResult> DeleteVehical(int id)
        {
            var vehical = await repository.GetVehical(id, includeRelated : false);

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

            repository.Remove(vehical);
            await unitOfWork.CompleteAsync();

            return(Ok(id));
        }
        public async Task <IActionResult> DeleteVehical(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var vehical = await vehicalRepository.GetVehical(id, false);

            if (vehical == null)
            {
                return(NotFound());
            }
            vehicalRepository.Remove(vehical);
            await unitOfWork.CompleteAsync();

            return(Ok(id));
        }