public async Task UpdateAsync(ShipmentStatusUpdate shipmentStatusUpdate)
        {
            var shipmentTableEntry = await GetShipmentTableEntryAsync(shipmentStatusUpdate.TrackingNumber);

            shipmentTableEntry.RowKey = DateTimeOffset.UtcNow.ToString("s");
            shipmentTableEntry.Status = shipmentStatusUpdate.Status.ToString();

            await _tableStorageAccessor.PersistAsync(TableName, shipmentTableEntry);
        }
Beispiel #2
0
        public Task UpdateAsync(ShipmentStatusUpdate shipmentStatusUpdate)
        {
            if (!_shipments.TryGetValue(shipmentStatusUpdate.TrackingNumber, out var foundShipmentInformation))
            {
                throw new ShipmentNotFoundException(shipmentStatusUpdate.TrackingNumber);
            }

            foundShipmentInformation.Status = shipmentStatusUpdate.Status;
            _shipments[shipmentStatusUpdate.TrackingNumber] = foundShipmentInformation;

            return(Task.CompletedTask);
        }
Beispiel #3
0
        public async Task <IActionResult> Shipment_UpdateStatus([FromBody] ShipmentStatusUpdate shipmentStatusUpdate)
        {
            try
            {
                await _shipmentRepository.UpdateAsync(shipmentStatusUpdate);

                return(Ok());
            }
            catch (ShipmentNotFoundException)
            {
                return(NotFound());
            }
        }