public void Save() { if (Materials.Count(mat => mat.Id == Id) != 0) { Update(); return; } //If material already exist; using (IDbConnection cnn = new SQLiteConnection(DBPath)) { cnn.Execute($"INSERT INTO Materials VALUES(@Id, @Name, @Type, @Mod, @Weight, @Color);", this); } }
public static Material GetMaterial(string id) => Materials.Count(mat => mat.Id == id) != 0 ? Materials.First(mat => mat.Id == id) : null;