public static void AddNewBatch(SqlConnection connection) { Batch batch = new Batch(); Console.WriteLine("Please, enter the batch details: "); Console.Write("Date: "); batch.Date = ConsoleInput.InputDate(); Console.Write("Select batch type: "); batch.BatchType = SelectBatchType(); BatchQuery batchQuery = new BatchQuery(connection); batchQuery.AddNewRecord(batch); int lastId = batchQuery.GetLastId(); Console.WriteLine("Please, add products to the batch (input product's Id and quantity): "); ProductBatchQuery productBatchQuery = new ProductBatchQuery(connection); AddRecordsIntoProductBatch(lastId, productBatchQuery); }