예제 #1
0
        public async Task <IActionResult> Delete(string id)
        {
            await _appRepository.DeleteAsync(id);

            await _localizationRepository.DeleteAll(id);

            return(Ok());
        }
예제 #2
0
        public async Task DeleteAsync(string id, CancellationToken ct = default)
        {
            Guard.NotNullOrEmpty(id, nameof(id));

            await repository.DeleteAsync(id, ct);

            await cache.RemoveAsync(id);
        }
예제 #3
0
        public async Task <IActionResult> ExecuteAsync(int carId, CancellationToken cancellationToken)
        {
            Car car = await _carRepository.GetAsync(carId, cancellationToken);

            if (car == null)
            {
                return(new NotFoundResult());
            }

            await _carRepository.DeleteAsync(car, cancellationToken);

            return(new NoContentResult());
        }
        public async Task <ICommandResult> Handle(DeleteCarCommand command, CancellationToken cancellationToken)
        {
            int carId = command.Id;

            Car car = await _carRepository.GetAsync(carId, cancellationToken);

            if (car == null)
            {
                return(new CommandResult(CommandStatus.NotFound));
            }

            await _carRepository.DeleteAsync(car, cancellationToken);

            return(new CommandResult(CommandStatus.Ok));
        }
예제 #5
0
        public async Task <ServiceResponeCode> Delete(int id)
        {
            if (id == 0)
            {
                return(ServiceResponeCode.INVALID);
            }
            try
            {
                await _appRepository.DeleteAsync(id);

                return(ServiceResponeCode.OK);
            }
            catch
            {
                return(ServiceResponeCode.ERROR);
            }
        }