static bool CheckIfSamePlace(Place place, JsonMoves.Day.Segment.Place jsonPlace) { if (place.name == jsonPlace.name) { if (HelpMethods.DistanceTo(place.location, jsonPlace.location) <= distanceTolerance) { return(true); } } return(false); }
public static int ReturnPlaceId(JsonMoves.Day.Segment.Place place, DateTime startTime, DateTime endTime) { foreach (var item in places) { if (CheckIfSamePlace(item, place)) { item.AddVisit(startTime, endTime); return(item.id); } } Place newPlace = new Place(currentId++, place.name, place.location); places.Add(newPlace); newPlace.AddVisit(startTime, endTime); return(newPlace.id); }