public async Task <Unit> Handle(DeleteOrderInput request, CancellationToken cancellationToken) { var isDeleted = await _orderRepository.DeleteAsync(request.Ttn, cancellationToken); if (isDeleted) { await _outputContext.NotifyAll().OrderDeleted(request.Ttn); } return(Unit.Value); }
public async Task <Unit> Handle(EditOrderLocationInput request, CancellationToken cancellationToken) { var ttn = new TTN(request.Ttn); var order = await _orderRepository.FindOrderAsync(ttn, cancellationToken); var newLocation = new Location(request.NewLocation.City, request.NewLocation.Street); order.ChangeLocation(newLocation); await _orderRepository.UpdateAsync(order, cancellationToken); await _outputContext.NotifyAll().OrderLocationChanged(new OrderLocationChangedViewModel { Ttn = request.Ttn, Location = request.NewLocation, }); return(Unit.Value); }