private async Task InitializeAsync(DualTransaction transaction) { sourceTransaction = transaction.Decrease; sourceSegment = await mapRepository.GetSegmentAsync(transaction.Decrease.StorageId); destinationSegment = await mapRepository.GetSegmentAsync(transaction.Increase.StorageId); }
public async Task ValidateAsync(DualTransaction transaction) { await InitializeAsync(transaction); if (IsCurrentUserNotSourceStorageOwnerOrSystem) { throw new NotAuthorizedException(); } if (!SourceAndDestinationAtOneSegment) { throw new ValidationException(); } }
private void InitializeTransaction() { var item = new Item(data.ItemName, data.ItemCount.Value); transaction = new DualTransaction(data.FromStorageId, data.ToStorageId, item); }