public void Save() { if (Generals.Count(gen => gen.Id == Id) != 0) { Update(); return; } //If general already exist; using (IDbConnection cnn = new SQLiteConnection(DBPath)) { cnn.Execute($"INSERT INTO Generals VALUES(@Id, @Name, @Description, @Type, @Health, @Size, @BuildTime, @BuildCost, @Mod, @Weight);", this); } }
public static General GetGeneral(string id) => Generals.Count(gen => gen.Id == id) != 0 ? Generals.First(gen => gen.Id == id) : null;