Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created June 1, 2022 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcomartin/1463b673d21ce879d814229bca57d104 to your computer and use it in GitHub Desktop.
Save dcomartin/1463b673d21ce879d814229bca57d104 to your computer and use it in GitHub Desktop.
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