Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created Jun 1, 2022
Embed
What would you like to do?
public class Shipment
{
public int ShipmentId { get; set; }
public List<Stop> Stops { get; set; }
public Stop GetStop(int stopId)
{
return Stops.Single(x => x.StopId == stopId);
}
public List<Stop> GetAllStops()
{
return Stops;
}
}
public class Stop
{
public int ShipmentId { get; set; }
public int StopId { get; set; }
public StopStatus Status { get; set; } = StopStatus.InTransit;
public DateTime Arrived { get; set; }
public DateTime? Departed { get; set; }
public void SetStatus(StopStatus status)
{
Status = status;
}
public void SetArrivedDateTime(DateTime dateTime)
{
Arrived = dateTime;
}
public void SetDepartedDateTime(DateTime dateTime)
{
Departed = dateTime;
}
}
public enum StopStatus
{
InTransit,
Arrived,
Departed
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment