C#C
C#15mo ago
PANZER234425

Call method with updated data

Hello, im currently trying to make an update function.
I got 2 lists:

public class AircraftData //stores the data for the startup
{
    public string? Registration { get; set; }
    public string? Type { get; set; }
    public int Seats { get; set; }
    public string? Engines { get; set; }
    public string? Airline { get; set; }
    public DateTime FirstFlight { get; set; }
    public string? SpecialLivery { get; set; }
    public byte[]? AircraftPicture { get; set; }
    public bool Favorite { get; set; }
}

public class SpecificAircraftData
{
    public string? Type { get; set; }
    public int Seats { get; set; }
    public string? Engines { get; set; }
    public DateTime FirstFlight { get; set; }
    public string? SpecialLivery { get; set; }
    public bool Favorite { get; set; }
}


The first list stores every aircraft, while the second one only stores variables that are updatable.
If I exit the form a sql script runs which pulls the updated data in the second list, then It gets updated on the "overview" in a User Control, the user control has a method which calls up a more detailed form where I can update attributes.

Problem: If I open the aircraftDetails (picAircraft_Click) Form the old data is getting showed because the method with the older data is given to it, now I had the idea to compare the two lists and if there is any difference then it should give the updated data and if not it should give the old (currentAircraft).

You guys got any fix for that or an better solution I can use to update the Details form?
Was this page helpful?