private List<service> GetService(int ServiceProviderId) { List<service> ReturnList = new List<service>(); foreach (Service s in SyncClient.GetService(GetFromDate, DateTimeNow, ServiceProviderId)) { service tmp = QueryService(s.Id); Boolean NewValue = false; if (tmp == null) { tmp = new service(); NewValue = true; } tmp.Id = s.Id; tmp.all_inclusive_extra_charge = s.AllInclExtra; tmp.amount_of_bookable_units = 10000; //nicht im Sync inbegriffen, darf in der DB aber nicht Null sein tmp.category_id = s.CategoryId; tmp.createdAt = System.DateTime.Parse(s.CreateDat); tmp.intro_text = s.IntroText; tmp.name = s.Name; tmp.price_incl_tax = s.PriceInclTax; tmp.product_source_id = s.ProductSourceId; tmp.service_provider_id = s.ServiceProviderId; tmp.service_unit = s.Unit; tmp.short_name = s.Shortname; tmp.tax_type = s.TaxType; if (NewValue) { dbContext.Set<service>().Add(tmp); } dbContext.SaveChanges(); ReturnList.Add(tmp); } return ReturnList; }