public async Task InsertPump(int dataSite, dynamic[] dataPump) { if (dataPump != null) { try { var dataToInsert = new Pump(); for (int number = 0; number < dataPump.Length; number++) { dataToInsert.id = null; dataToInsert.site_id = dataSite; dataToInsert.pump_profile_id = dataPump[number].Pump_Profile_ID; dataToInsert.pump_profile_pump_id = dataPump[number].Pump_Profile_Pump_ID; dataToInsert.auto_authorise = dataPump[number].Auto_Authorise; dataToInsert.allow_postpay = dataPump[number].Allow_Postpay; dataToInsert.allow_prepay = dataPump[number].Allow_Prepay; dataToInsert.allow_preauth = dataPump[number].Allow_Preauth; dataToInsert.allow_monitor = dataPump[number].Allow_Monitor; dataToInsert.pump_lights = dataPump[number].Pump_Lights; dataToInsert.pump_stacking = dataPump[number].Pump_Stacking; dataToInsert.pump_auto_stacking = dataPump[number].Pump_Auto_Stacking; dataToInsert.allow_attendant = dataPump[number].Allow_Attendant; dataToInsert.prof_price_1_level = dataPump[number].prof_Price_1_Level; dataToInsert.prof_prive_2_level = dataPump[number].prof_Price_2_Level; dataToInsert.site_profile_id = dataPump[number].Site_Profile_ID; dataToInsert.fallback_allow = dataPump[number].Fallback_allow; dataToInsert.fallback_automatic = dataPump[number].Fallback_automatic; dataToInsert.tag_reader_active = dataPump[number].Tag_Reader_Active; dataToInsert.attendant_tag_auth = dataPump[number].Attendant_Tag_Auth; dataToInsert.external_tag_auth = dataPump[number].External_Tag_Auth; dataToInsert.stack_size = dataPump[number].Stack_Size; Logger.Info("Data pump mashok = " + string.Join(" ", dataToInsert.GetType() .GetProperties() .Select(prop => prop.GetValue(dataToInsert)))); await _context.pumps.AddAsync(dataToInsert); await _context.SaveChangesAsync(); Logger.Info("Data pump inserted"); } } catch (Exception ex) { Debug.WriteLine("Insert Pump Data Exception: " + ex.Message); throw; } } }