internal void UpdateDB(List<OkPneuTire> TireList) { DataClassesDataContext db = new DataClassesDataContext(); foreach (var i in TireList) { if (i.ExternalStore > 0) i.ProdejniCena = i.NakupniCena; else if (i.NakupniCenaCZ > 0) i.ProdejniCena = i.NakupniCenaCZ; else i.ProdejniCena = i.NakupniCenaEU; if (!db.SuplierTiresOKpneus.Any(u => u.EAN == i.EAN)) { try { db.InsertTire(i.EAN, i.Manufacturer, i.Detail, i.ExternalStore, i.code, 0, i.ProdejniCena, i.Name, i.Season[0], i.Description, i.ImageURL); } catch (Exception ex) { Console.WriteLine("error" + ex); } } else { db.UpdateTires(i.EAN, i.ProdejniCena, i.ExternalStore); } } }