private List<order_item_report_appendix> GetOrderItemReportAppendix(int ServiceProviderId) { List<order_item_report_appendix> ReturnList = new List<order_item_report_appendix>(); foreach (OrderItemReportAp OIRA in SyncClient.GetOrderItemReportAp(GetFromDate, DateTimeNow, ServiceProviderId)) { order_item_report_appendix tmp = QueryOrderItemReportAppendix(new Guid(OIRA.Id)); Boolean NewValue = false; if (tmp == null) { tmp = new order_item_report_appendix(); NewValue = true; } tmp.Id = new Guid(OIRA.Id); tmp.appendix = OIRA.Appendix; tmp.order_item_report_id = new Guid(OIRA.OrderItemReportId); tmp.createdat = System.DateTime.Parse(OIRA.CreateDat); if (NewValue) { dbContext.Set<order_item_report_appendix>().Add(tmp); } dbContext.SaveChanges(); ReturnList.Add(tmp); } return ReturnList; }