public async Task <IActionResult> Delete(string id) { await _appRepository.DeleteAsync(id); await _localizationRepository.DeleteAll(id); return(Ok()); }
public async Task DeleteAsync(string id, CancellationToken ct = default) { Guard.NotNullOrEmpty(id, nameof(id)); await repository.DeleteAsync(id, ct); await cache.RemoveAsync(id); }
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)); }
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); } }